diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs index b4519b7cbb98..800157c28d9a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs @@ -102,8 +102,11 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -367,7 +369,10 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -378,7 +383,6 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -390,9 +394,9 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -500,7 +504,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -578,8 +582,11 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -592,7 +599,6 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -605,9 +611,9 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -799,8 +805,11 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -813,7 +822,6 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -826,9 +834,9 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1115,7 +1123,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs index 72cf135164d9..c833ef4a36b9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs @@ -93,7 +93,10 @@ internal CapabilitiesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -103,7 +106,6 @@ internal CapabilitiesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("locationName", locationName); tracingParameters.Add("include", include); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -117,9 +119,9 @@ internal CapabilitiesOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("include={0}", System.Uri.EscapeDataString(include))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperationsExtensions.cs deleted file mode 100644 index 9ef18db47332..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperationsExtensions.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DataMaskingPoliciesOperations. - /// - public static partial class DataMaskingPoliciesOperationsExtensions - { - /// - /// Creates or updates a database data masking policy - /// - /// - /// 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. - /// - /// - /// Parameters for creating or updating a data masking policy. - /// - public static DataMaskingPolicy CreateOrUpdate(this IDataMaskingPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a database data masking policy - /// - /// - /// 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. - /// - /// - /// Parameters for creating or updating a data masking policy. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDataMaskingPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a database data masking policy. - /// - /// - /// 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 DataMaskingPolicy Get(this IDataMaskingPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Gets a database data masking policy. - /// - /// - /// 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 Task GetAsync(this IDataMaskingPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs similarity index 67% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs index 00564efdc504..d70d73d2f51b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DatabaseThreatDetectionPoliciesOperations operations. + /// DataWarehouseUserActivitiesOperations operations. /// - internal partial class DatabaseThreatDetectionPoliciesOperations : IServiceOperations, IDatabaseThreatDetectionPoliciesOperations + internal partial class DataWarehouseUserActivitiesOperations : IServiceOperations, IDataWarehouseUserActivitiesOperations { /// - /// Initializes a new instance of the DatabaseThreatDetectionPoliciesOperations class. + /// Initializes a new instance of the DataWarehouseUserActivitiesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class DatabaseThreatDetectionPoliciesOperations : IServiceOpera /// /// Thrown when a required parameter is null /// - internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) + internal DataWarehouseUserActivitiesOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,8 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a database's threat detection policy. + /// Gets the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,8 +62,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database. /// /// /// Headers that will be added to request. @@ -85,12 +85,8 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -103,8 +99,15 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string securityAlertPolicyName = "default"; - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string dataWarehouseUserActivityName = "current"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,23 +118,22 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("dataWarehouseUserActivityName", dataWarehouseUserActivityName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}").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("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{dataWarehouseUserActivityName}", System.Uri.EscapeDataString(dataWarehouseUserActivityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -239,7 +241,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -259,7 +261,8 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) } /// - /// Creates or updates a database's threat detection policy. + /// List the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The name of the resource group that contains the resource. You can obtain @@ -269,11 +272,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. - /// - /// - /// The database Threat Detection policy. + /// The name of the database. /// /// /// Headers that will be added to request. @@ -296,12 +295,8 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -314,16 +309,14 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string securityAlertPolicyName = "default"; - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -334,24 +327,20 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities").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("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -360,7 +349,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -391,12 +380,6 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -417,7 +400,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -452,7 +435,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -465,7 +448,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -477,13 +460,169 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs similarity index 54% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs index 531cfcc17530..7a9e1e8ce98f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs @@ -13,18 +13,17 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for DataMaskingRulesOperations. + /// Extension methods for DataWarehouseUserActivitiesOperations. /// - public static partial class DataMaskingRulesOperationsExtensions + public static partial class DataWarehouseUserActivitiesOperationsExtensions { /// - /// Creates or updates a database data masking rule. + /// Gets the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -39,19 +38,14 @@ public static partial class DataMaskingRulesOperationsExtensions /// /// The name of the database. /// - /// - /// The name of the data masking rule. - /// - /// - /// The required parameters for creating or updating a data masking rule. - /// - public static DataMaskingRule CreateOrUpdate(this IDataMaskingRulesOperations operations, string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters) + public static DataWarehouseUserActivities Get(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Creates or updates a database data masking rule. + /// Gets the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -66,25 +60,20 @@ public static DataMaskingRule CreateOrUpdate(this IDataMaskingRulesOperations op /// /// The name of the database. /// - /// - /// The name of the data masking rule. - /// - /// - /// The required parameters for creating or updating a data masking rule. - /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDataMaskingRulesOperations operations, string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of database data masking rules. + /// List the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -99,13 +88,14 @@ public static DataMaskingRule CreateOrUpdate(this IDataMaskingRulesOperations op /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IDataMaskingRulesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a list of database data masking rules. + /// List the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -123,7 +113,7 @@ public static IEnumerable ListByDatabase(this IDataMaskingRules /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IDataMaskingRulesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -131,5 +121,41 @@ public static IEnumerable ListByDatabase(this IDataMaskingRules } } + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDataWarehouseUserActivitiesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDataWarehouseUserActivitiesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs similarity index 86% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs index 98aee022bf1f..014d04528f43 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// GeoBackupPoliciesOperations operations. + /// DatabaseAdvisorsOperations operations. /// - internal partial class GeoBackupPoliciesOperations : IServiceOperations, IGeoBackupPoliciesOperations + internal partial class DatabaseAdvisorsOperations : IServiceOperations, IDatabaseAdvisorsOperations { /// - /// Initializes a new instance of the GeoBackupPoliciesOperations class. + /// Initializes a new instance of the DatabaseAdvisorsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class GeoBackupPoliciesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal GeoBackupPoliciesOperations(SqlManagementClient client) + internal DatabaseAdvisorsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Updates a database geo backup policy. + /// Gets a list of database advisors. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -63,8 +63,8 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// The required parameters for creating or updating the geo backup policy. + /// + /// The child resources to include in the response. /// /// /// Headers that will be added to request. @@ -87,12 +87,8 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, GeoBackupPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -105,16 +101,14 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; - string geoBackupPolicyName = "Default"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -122,27 +116,28 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("geoBackupPolicyName", geoBackupPolicyName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors").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("{geoBackupPolicyName}", System.Uri.EscapeDataString(geoBackupPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -151,7 +146,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -182,12 +177,6 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -208,7 +197,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -243,7 +232,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -256,25 +245,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -294,7 +265,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) } /// - /// Gets a geo backup policy. + /// Gets a database advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -306,6 +277,9 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// /// /// Headers that will be added to request. /// @@ -327,12 +301,8 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -345,8 +315,18 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string geoBackupPolicyName = "Default"; + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,26 +334,25 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("geoBackupPolicyName", geoBackupPolicyName); + tracingParameters.Add("advisorName", advisorName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}").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("{geoBackupPolicyName}", System.Uri.EscapeDataString(geoBackupPolicyName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -468,7 +447,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -481,7 +460,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -501,7 +480,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) } /// - /// Returns a list of geo backup policies. + /// Updates a database advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -513,6 +492,12 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// + /// + /// The requested advisor resource state. + /// /// /// Headers that will be added to request. /// @@ -534,12 +519,8 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -552,7 +533,22 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -560,24 +556,26 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}").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("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -586,7 +584,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -617,6 +615,12 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -672,7 +676,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -685,7 +689,7 @@ internal GeoBackupPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs similarity index 63% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs index 8f06fd54be49..d4dfab76c155 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/GeoBackupPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for GeoBackupPoliciesOperations. + /// Extension methods for DatabaseAdvisorsOperations. /// - public static partial class GeoBackupPoliciesOperationsExtensions + public static partial class DatabaseAdvisorsOperationsExtensions { /// - /// Updates a database geo backup policy. + /// Gets a list of database advisors. /// /// /// The operations group for this extension method. @@ -39,16 +39,16 @@ public static partial class GeoBackupPoliciesOperationsExtensions /// /// The name of the database. /// - /// - /// The required parameters for creating or updating the geo backup policy. + /// + /// The child resources to include in the response. /// - public static GeoBackupPolicy CreateOrUpdate(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, GeoBackupPolicy parameters) + public static IList ListByDatabase(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string)) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, expand).GetAwaiter().GetResult(); } /// - /// Updates a database geo backup policy. + /// Gets a list of database advisors. /// /// /// The operations group for this extension method. @@ -63,22 +63,22 @@ public static GeoBackupPolicy CreateOrUpdate(this IGeoBackupPoliciesOperations o /// /// The name of the database. /// - /// - /// The required parameters for creating or updating the geo backup policy. + /// + /// The child resources to include in the response. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, GeoBackupPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a geo backup policy. + /// Gets a database advisor. /// /// /// The operations group for this extension method. @@ -93,13 +93,16 @@ public static GeoBackupPolicy CreateOrUpdate(this IGeoBackupPoliciesOperations o /// /// The name of the database. /// - public static GeoBackupPolicy Get(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The name of the Database Advisor. + /// + public static Advisor Get(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, advisorName).GetAwaiter().GetResult(); } /// - /// Gets a geo backup policy. + /// Gets a database advisor. /// /// /// The operations group for this extension method. @@ -114,19 +117,22 @@ public static GeoBackupPolicy Get(this IGeoBackupPoliciesOperations operations, /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns a list of geo backup policies. + /// Updates a database advisor. /// /// /// The operations group for this extension method. @@ -141,13 +147,19 @@ public static GeoBackupPolicy Get(this IGeoBackupPoliciesOperations operations, /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The name of the Database Advisor. + /// + /// + /// The requested advisor resource state. + /// + public static Advisor Update(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters) { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, parameters).GetAwaiter().GetResult(); } /// - /// Returns a list of geo backup policies. + /// Updates a database advisor. /// /// /// The operations group for this extension method. @@ -162,12 +174,18 @@ public static IEnumerable ListByDatabase(this IGeoBackupPolicie /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// + /// + /// The requested advisor resource state. + /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IGeoBackupPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs index 4c469aa37322..71921ad07700 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs @@ -102,7 +102,10 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -313,7 +315,10 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +330,6 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -337,9 +341,9 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs index 4637ddb70005..069766a73b29 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs @@ -102,8 +102,11 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -320,8 +322,11 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -334,7 +339,6 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -347,9 +351,9 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -552,7 +556,10 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -563,7 +570,6 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -575,9 +581,9 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -685,7 +691,7 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -858,7 +864,7 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs new file mode 100644 index 000000000000..9d4d3f447a74 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs @@ -0,0 +1,1152 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseColumnsOperations operations. + /// + internal partial class DatabaseColumnsOperations : IServiceOperations, IDatabaseColumnsOperations + { + /// + /// Initializes a new instance of the DatabaseColumnsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseColumnsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List database columns + /// + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schema", schema); + tracingParameters.Add("table", table); + tracingParameters.Add("column", column); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/columns").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(Client.SubscriptionId)); + List _queryParameters = new List(); + if (schema != null) + { + if (schema.Count == 0) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in schema) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (table != null) + { + if (table.Count == 0) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in table) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (column != null) + { + if (column.Count == 0) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in column) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (orderBy != null) + { + if (orderBy.Count == 0) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in orderBy) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database columns + /// + /// + /// 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 name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns").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("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get database column + /// + /// + /// 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 name of the table. + /// + /// + /// The name of the column. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}").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("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTableNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs new file mode 100644 index 000000000000..f6ed91d081e8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseColumnsOperations. + /// + public static partial class DatabaseColumnsOperationsExtensions + { + /// + /// List database columns + /// + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// 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 name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByTable(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// 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 name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get database column + /// + /// + /// 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 name of the table. + /// + /// + /// The name of the column. + /// + public static DatabaseColumn Get(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Get database column + /// + /// + /// 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 name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByTableNext(this IDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByTableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableNextAsync(this IDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs similarity index 83% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs index 093cf7c48461..33c486b8b247 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServerCommunicationLinksOperations operations. + /// DatabaseExtensionsOperations operations. /// - internal partial class ServerCommunicationLinksOperations : IServiceOperations, IServerCommunicationLinksOperations + internal partial class DatabaseExtensionsOperations : IServiceOperations, IDatabaseExtensionsOperations { /// - /// Initializes a new instance of the ServerCommunicationLinksOperations class. + /// Initializes a new instance of the DatabaseExtensionsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServerCommunicationLinksOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServerCommunicationLinksOperations(SqlManagementClient client) + internal DatabaseExtensionsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,8 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Deletes a server communication link. + /// Gets a database extension. This will return resource not found as it is not + /// supported. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,8 +61,10 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// /// /// /// Headers that will be added to request. @@ -81,12 +84,8 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -95,11 +94,22 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (communicationLinkName == null) + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (extensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "communicationLinkName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,24 +117,25 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("communicationLinkName", communicationLinkName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("extensionName", extensionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{communicationLinkName}", System.Uri.EscapeDataString(communicationLinkName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{extensionName}", System.Uri.EscapeDataString(extensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -133,7 +144,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -234,7 +245,39 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) } /// - /// Returns a server communication link. + /// Perform a database extension operation, like polybase import + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -243,8 +286,8 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. /// /// /// Headers that will be added to request. @@ -267,12 +310,8 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -281,11 +320,18 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (communicationLinkName == null) + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "communicationLinkName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -293,24 +339,23 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("communicationLinkName", communicationLinkName); + tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{communicationLinkName}", System.Uri.EscapeDataString(communicationLinkName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -405,7 +450,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -418,7 +463,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -438,7 +483,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) } /// - /// Creates a server communication link. + /// Perform a database extension operation, like polybase import /// /// /// The name of the resource group that contains the resource. You can obtain @@ -447,34 +492,13 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the server communication link. - /// - /// - /// The required parameters for creating a server communication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. + /// + /// The name of the database. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, communicationLinkName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of server communication links. - /// - /// - /// 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 database import request parameters. /// /// /// Headers that will be added to request. @@ -497,12 +521,8 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -511,7 +531,30 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (extensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -519,22 +562,26 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("extensionName", extensionName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}").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("{extensionName}", System.Uri.EscapeDataString(extensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -543,7 +590,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -574,6 +621,12 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -594,7 +647,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -629,7 +682,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -642,7 +695,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -662,20 +715,11 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) } /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is not + /// supported. /// - /// - /// 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 server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -698,33 +742,12 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (communicationLinkName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "communicationLinkName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -732,26 +755,14 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("communicationLinkName", communicationLinkName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{communicationLinkName}", System.Uri.EscapeDataString(communicationLinkName)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -759,7 +770,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -790,12 +801,6 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -816,7 +821,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -851,7 +856,7 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -859,12 +864,12 @@ internal ServerCommunicationLinksOperations(SqlManagementClient client) _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs similarity index 53% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs index 3d897732f85e..d3803beced06 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerCommunicationLinksOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs @@ -13,18 +13,17 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for ServerCommunicationLinksOperations. + /// Extension methods for DatabaseExtensionsOperations. /// - public static partial class ServerCommunicationLinksOperationsExtensions + public static partial class DatabaseExtensionsOperationsExtensions { /// - /// Deletes a server communication link. + /// Gets a database extension. This will return resource not found as it is not + /// supported. /// /// /// The operations group for this extension method. @@ -36,16 +35,19 @@ public static partial class ServerCommunicationLinksOperationsExtensions /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. /// - public static void Delete(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName) + /// + /// + public static void Get(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName) { - operations.DeleteAsync(resourceGroupName, serverName, communicationLinkName).GetAwaiter().GetResult(); + operations.GetAsync(resourceGroupName, serverName, databaseName, extensionName).GetAwaiter().GetResult(); } /// - /// Deletes a server communication link. + /// Gets a database extension. This will return resource not found as it is not + /// supported. /// /// /// The operations group for this extension method. @@ -57,19 +59,21 @@ public static void Delete(this IServerCommunicationLinksOperations operations, s /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, communicationLinkName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Returns a server communication link. + /// Perform a database extension operation, like polybase import /// /// /// The operations group for this extension method. @@ -81,16 +85,21 @@ public static void Delete(this IServerCommunicationLinksOperations operations, s /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. /// - public static ServerCommunicationLink Get(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName) + public static ImportExportExtensionsOperationResult CreateOrUpdate(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters) { - return operations.GetAsync(resourceGroupName, serverName, communicationLinkName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).GetAwaiter().GetResult(); } /// - /// Returns a server communication link. + /// Perform a database extension operation, like polybase import /// /// /// The operations group for this extension method. @@ -102,22 +111,28 @@ public static ServerCommunicationLink Get(this IServerCommunicationLinksOperatio /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, communicationLinkName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is not + /// supported. /// /// /// The operations group for this extension method. @@ -129,19 +144,17 @@ public static ServerCommunicationLink Get(this IServerCommunicationLinksOperatio /// /// The name of the server. /// - /// - /// The name of the server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The name of the database. /// - public static ServerCommunicationLink CreateOrUpdate(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters) + public static IPage ListByDatabase(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is not + /// supported. /// /// /// The operations group for this extension method. @@ -153,25 +166,22 @@ public static ServerCommunicationLink CreateOrUpdate(this IServerCommunicationLi /// /// The name of the server. /// - /// - /// The name of the server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The name of the database. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, communicationLinkName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of server communication links. + /// Perform a database extension operation, like polybase import /// /// /// The operations group for this extension method. @@ -183,13 +193,21 @@ public static ServerCommunicationLink CreateOrUpdate(this IServerCommunicationLi /// /// The name of the server. /// - public static IEnumerable ListByServer(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. + /// + public static ImportExportExtensionsOperationResult BeginCreateOrUpdate(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).GetAwaiter().GetResult(); } /// - /// Gets a list of server communication links. + /// Perform a database extension operation, like polybase import /// /// /// The operations group for this extension method. @@ -201,66 +219,56 @@ public static IEnumerable ListByServer(this IServerComm /// /// The name of the server. /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is not + /// supported. /// /// /// 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 server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The NextLink from the previous successful call to List operation. /// - public static ServerCommunicationLink BeginCreateOrUpdate(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters) + public static IPage ListByDatabaseNext(this IDatabaseExtensionsOperations operations, string nextPageLink) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters).GetAwaiter().GetResult(); + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is not + /// supported. /// /// /// 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 server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IServerCommunicationLinksOperations operations, string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseNextAsync(this IDatabaseExtensionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, communicationLinkName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs index ebedc7aca5bd..a58e213065c7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs @@ -102,7 +102,10 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,7 +117,6 @@ internal DatabaseOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } @@ -127,9 +129,9 @@ internal DatabaseOperations(SqlManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -290,7 +292,10 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -301,7 +306,6 @@ internal DatabaseOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -313,9 +317,9 @@ internal DatabaseOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -423,7 +427,7 @@ internal DatabaseOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -596,7 +600,7 @@ internal DatabaseOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs new file mode 100644 index 000000000000..177db48a178b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs @@ -0,0 +1,731 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseRecommendedActionsOperations operations. + /// + internal partial class DatabaseRecommendedActionsOperations : IServiceOperations, IDatabaseRecommendedActionsOperations + { + /// + /// Initializes a new instance of the DatabaseRecommendedActionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseRecommendedActionsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// 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 Database Advisor. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseAdvisorWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseAdvisor", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions").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("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (recommendedActionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "recommendedActionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("recommendedActionName", recommendedActionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}").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("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{recommendedActionName}", System.Uri.EscapeDataString(recommendedActionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The requested recommended action resource state. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (recommendedActionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "recommendedActionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("recommendedActionName", recommendedActionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}").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("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{recommendedActionName}", System.Uri.EscapeDataString(recommendedActionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs new file mode 100644 index 000000000000..cd6895363f77 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs @@ -0,0 +1,207 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseRecommendedActionsOperations. + /// + public static partial class DatabaseRecommendedActionsOperationsExtensions + { + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// 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 Database Advisor. + /// + public static IList ListByDatabaseAdvisor(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName) + { + return operations.ListByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAdvisorAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseAdvisorWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + public static RecommendedAction Get(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The requested recommended action resource state. + /// + public static RecommendedAction Update(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters) + { + return operations.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The requested recommended action resource state. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs similarity index 66% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs index e73daf744ed7..6dcbfe07f276 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using Newtonsoft.Json; using System.Collections; @@ -23,12 +24,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DataMaskingRulesOperations operations. + /// DatabaseSchemasOperations operations. /// - internal partial class DataMaskingRulesOperations : IServiceOperations, IDataMaskingRulesOperations + internal partial class DatabaseSchemasOperations : IServiceOperations, IDatabaseSchemasOperations { /// - /// Initializes a new instance of the DataMaskingRulesOperations class. + /// Initializes a new instance of the DatabaseSchemasOperations class. /// /// /// Reference to the service client. @@ -36,7 +37,7 @@ internal partial class DataMaskingRulesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal DataMaskingRulesOperations(SqlManagementClient client) + internal DatabaseSchemasOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +52,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Creates or updates a database data masking rule. + /// List database schemas /// /// /// The name of the resource group that contains the resource. You can obtain @@ -63,11 +64,8 @@ internal DataMaskingRulesOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// The name of the data masking rule. - /// - /// - /// The required parameters for creating or updating a data masking rule. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -90,12 +88,8 @@ internal DataMaskingRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -108,20 +102,14 @@ internal DataMaskingRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (dataMaskingRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataMaskingRuleName"); - } - if (parameters == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; - string dataMaskingPolicyName = "Default"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -129,29 +117,32 @@ internal DataMaskingRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("dataMaskingPolicyName", dataMaskingPolicyName); - tracingParameters.Add("dataMaskingRuleName", dataMaskingRuleName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("{dataMaskingPolicyName}", System.Uri.EscapeDataString(dataMaskingPolicyName)); - _url = _url.Replace("{dataMaskingRuleName}", System.Uri.EscapeDataString(dataMaskingRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (odataQuery != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -160,7 +151,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -191,12 +182,6 @@ internal DataMaskingRulesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -217,7 +202,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -252,7 +237,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -265,25 +250,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -303,7 +270,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) } /// - /// Gets a list of database data masking rules. + /// Get database schema /// /// /// The name of the resource group that contains the resource. You can obtain @@ -315,6 +282,9 @@ internal DataMaskingRulesOperations(SqlManagementClient client) /// /// The name of the database. /// + /// + /// The name of the schema. + /// /// /// Headers that will be added to request. /// @@ -336,12 +306,8 @@ internal DataMaskingRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -354,8 +320,18 @@ internal DataMaskingRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string dataMaskingPolicyName = "Default"; + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -363,27 +339,199 @@ internal DataMaskingRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("dataMaskingPolicyName", dataMaskingPolicyName); + tracingParameters.Add("schemaName", schemaName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("{dataMaskingPolicyName}", System.Uri.EscapeDataString(dataMaskingPolicyName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -477,7 +625,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -490,7 +638,7 @@ internal DataMaskingRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs similarity index 50% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs index 251b52dc9470..311a84992304 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs @@ -12,19 +12,18 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for ServiceTierAdvisorsOperations. + /// Extension methods for DatabaseSchemasOperations. /// - public static partial class ServiceTierAdvisorsOperationsExtensions + public static partial class DatabaseSchemasOperationsExtensions { /// - /// Gets a service tier advisor. + /// List database schemas /// /// /// The operations group for this extension method. @@ -37,18 +36,18 @@ public static partial class ServiceTierAdvisorsOperationsExtensions /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// - /// - /// The name of service tier advisor. + /// + /// OData parameters to apply to the operation. /// - public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName) + public static IPage ListByDatabase(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); } /// - /// Gets a service tier advisor. + /// List database schemas /// /// /// The operations group for this extension method. @@ -61,24 +60,24 @@ public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operati /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// - /// - /// The name of service tier advisor. + /// + /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns service tier advisors for specified database. + /// Get database schema /// /// /// The operations group for this extension method. @@ -91,15 +90,18 @@ public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operati /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// - public static IEnumerable ListByDatabase(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The name of the schema. + /// + public static DatabaseSchema Get(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName) { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName).GetAwaiter().GetResult(); } /// - /// Returns service tier advisors for specified database. + /// Get database schema /// /// /// The operations group for this extension method. @@ -112,14 +114,51 @@ public static IEnumerable ListByDatabase(this IServiceTierAd /// The name of the server. /// /// - /// The name of database. + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default(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 IPage ListByDatabaseNext(this IDatabaseSchemasOperations operations, string nextPageLink) + { + return 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 Task> ListByDatabaseAsync(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseNextAsync(this IDatabaseSchemasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs new file mode 100644 index 000000000000..cca22aae503d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs @@ -0,0 +1,887 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSecurityAlertPoliciesOperations operations. + /// + internal partial class DatabaseSecurityAlertPoliciesOperations : IServiceOperations, IDatabaseSecurityAlertPoliciesOperations + { + /// + /// Initializes a new instance of the DatabaseSecurityAlertPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseSecurityAlertPoliciesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string securityAlertPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").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("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// The database security alert policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string securityAlertPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").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("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies").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(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..937a0739cb2f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs @@ -0,0 +1,209 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseSecurityAlertPoliciesOperations. + /// + public static partial class DatabaseSecurityAlertPoliciesOperationsExtensions + { + /// + /// Gets a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + public static DatabaseSecurityAlertPolicy Get(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// The database security alert policy. + /// + public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// The database security alert policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// 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 for which the security alert policy is defined. + /// + public static IPage ListByDatabase(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// 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 for which the security alert policy is defined. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseSecurityAlertPoliciesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs new file mode 100644 index 000000000000..d4d9d90807ea --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs @@ -0,0 +1,679 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseTablesOperations operations. + /// + internal partial class DatabaseTablesOperations : IServiceOperations, IDatabaseTablesOperations + { + /// + /// Initializes a new instance of the DatabaseTablesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseTablesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List database tables + /// + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchema", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables").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(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get database table + /// + /// + /// 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 name of the table. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}").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("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchemaNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs new file mode 100644 index 000000000000..3435ed84370b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseTablesOperations. + /// + public static partial class DatabaseTablesOperationsExtensions + { + /// + /// List database tables + /// + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySchema(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database tables + /// + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaAsync(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get database table + /// + /// + /// 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 name of the table. + /// + public static DatabaseTable Get(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName).GetAwaiter().GetResult(); + } + + /// + /// Get database table + /// + /// + /// 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 name of the table. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySchemaNext(this IDatabaseTablesOperations operations, string nextPageLink) + { + return operations.ListBySchemaNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaNextAsync(this IDatabaseTablesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs index 3a7c09cb5592..ec85406552d3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs @@ -51,7 +51,7 @@ internal DatabaseUsagesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Returns database usages. + /// Gets database usages. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -84,12 +84,8 @@ internal DatabaseUsagesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -102,7 +98,14 @@ internal DatabaseUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,7 +113,6 @@ internal DatabaseUsagesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); @@ -120,15 +122,188 @@ internal DatabaseUsagesOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets database usages. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -222,7 +397,7 @@ internal DatabaseUsagesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs index c6c2c68f544c..7c929e47e73b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class DatabaseUsagesOperationsExtensions { /// - /// Returns database usages. + /// Gets database usages. /// /// /// The operations group for this extension method. @@ -39,13 +37,13 @@ public static partial class DatabaseUsagesOperationsExtensions /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Returns database usages. + /// Gets database usages. /// /// /// The operations group for this extension method. @@ -63,7 +61,7 @@ public static IEnumerable ListByDatabase(this IDatabaseUsagesOper /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -71,5 +69,39 @@ public static IEnumerable ListByDatabase(this IDatabaseUsagesOper } } + /// + /// Gets database usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseUsagesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets database usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseUsagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs index 6af06a2cb7b1..88ea356dd5b7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs @@ -115,8 +115,11 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -130,7 +133,6 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -145,9 +147,9 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -350,8 +352,11 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -366,7 +371,6 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -381,9 +385,9 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -578,8 +582,11 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -593,7 +600,6 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -608,9 +614,9 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs index 2b7ab1bf71fc..102c1c255096 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs @@ -50,6 +50,35 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie /// public SqlManagementClient Client { get; private set; } + /// + /// Executes a Vulnerability Assessment database scan. + /// + /// + /// 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 vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Lists the vulnerability assessment scans of a database. /// @@ -102,8 +131,11 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +147,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -128,9 +159,9 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -238,7 +269,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -316,8 +347,11 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -330,7 +364,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -344,9 +377,9 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -473,35 +506,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie return _result; } - /// - /// Executes a Vulnerability Assessment database scan. - /// - /// - /// 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 vulnerability assessment scan Id of the scan to retrieve. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Convert an existing scan result to a human readable format. If already /// exists nothing happens @@ -562,8 +566,11 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -576,7 +583,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Export", tracingParameters); } @@ -590,9 +596,9 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -793,8 +799,11 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -807,7 +816,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginInitiateScan", tracingParameters); } @@ -821,9 +829,9 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1086,7 +1094,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs index e583bfef5abd..b4eb4b2cad53 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class DatabaseVulnerabilityAssessmentScansOperationsExtensions { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -37,13 +37,16 @@ public static partial class DatabaseVulnerabilityAssessmentScansOperationsExtens /// /// The name of the database. /// - public static IPage ListByDatabase(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + operations.InitiateScanAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -58,19 +61,19 @@ public static IPage ListByDatabase(this IData /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateScanAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -85,16 +88,13 @@ public static IPage ListByDatabase(this IData /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// - public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) + public static IPage ListByDatabase(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -109,22 +109,19 @@ public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityA /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -142,13 +139,13 @@ public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityA /// /// The vulnerability assessment scan Id of the scan to retrieve. /// - public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) + public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) { - operations.InitiateScanAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -169,9 +166,12 @@ public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperat /// /// The cancellation token. /// - public static async Task InitiateScanAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs index 1b1ced93379f..aaacd230f056 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs @@ -102,8 +102,11 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -316,8 +318,11 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -330,7 +335,6 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -343,9 +347,9 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -545,8 +549,11 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -558,7 +565,6 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -571,9 +577,9 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -735,7 +741,10 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -746,7 +755,6 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -758,9 +766,9 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -868,7 +876,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1041,7 +1049,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs index c127e57aeb8a..9ada939a9288 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs @@ -51,7 +51,7 @@ internal DatabasesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Returns database metrics. + /// Gets a list of databases. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,12 +60,6 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the database. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// /// /// Headers that will be added to request. /// @@ -87,12 +81,8 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -101,15 +91,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (databaseName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (filter == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "filter"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -117,29 +106,21 @@ internal DatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases").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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -234,7 +215,7 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -247,7 +228,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -267,7 +248,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Returns database metric definitions. + /// Gets a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -300,12 +281,8 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -318,7 +295,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -326,24 +310,23 @@ internal DatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinitions", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -438,7 +421,7 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -451,7 +434,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -471,7 +454,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Exports a database. + /// Creates a new database or updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -484,7 +467,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the database. /// /// - /// The database export request parameters. + /// The requested database resource state. /// /// /// The headers that will be added to request. @@ -492,15 +475,70 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Gets a list of databases. + /// 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. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a list of databases in an elastic pool. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -509,6 +547,9 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The name of the elastic pool. + /// /// /// Headers that will be added to request. /// @@ -530,7 +571,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -540,11 +581,18 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + if (elasticPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -554,20 +602,21 @@ internal DatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("elasticPoolName", elasticPoolName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -675,7 +724,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -695,7 +744,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Gets a database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -705,7 +754,86 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to be paused. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Resumes 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 resumed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Failovers 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 failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a list of inaccessible databases in a logical server + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. /// /// /// Headers that will be added to request. @@ -728,7 +856,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListInaccessibleByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -738,15 +866,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -756,22 +883,19 @@ internal DatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListInaccessibleByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/inaccessibleDatabases").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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -866,7 +990,7 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -879,7 +1003,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -899,7 +1023,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Creates a new database or updates an existing database. + /// Upgrades a data warehouse. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -909,10 +1033,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. - /// - /// - /// The requested database resource state. + /// The name of the database to be upgraded. /// /// /// The headers that will be added to request. @@ -920,15 +1041,15 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send request + AzureOperationResponse _response = await BeginUpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Deletes the database. + /// Renames a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -938,65 +1059,13 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to rename. + /// + /// + /// The resource move definition for renaming this database. /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// 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. - /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of databases in an elastic pool. - /// - /// - /// 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 elastic pool. - /// - /// - /// Headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. @@ -1004,9 +1073,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 /// @@ -1016,7 +1082,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1026,15 +1092,26 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (elasticPoolName == null) + if (databaseName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1044,22 +1121,22 @@ internal DatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Rename", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1068,7 +1145,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1099,6 +1176,12 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1154,31 +1237,13 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1187,7 +1252,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Pauses a database. + /// Imports a bacpac into a new database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1197,7 +1262,10 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database. + /// + /// + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -1205,15 +1273,15 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task> PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Resumes a database. + /// Exports a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1223,7 +1291,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. /// /// /// The headers that will be added to request. @@ -1231,15 +1302,15 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Failovers a database. + /// Creates a new database or updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1249,34 +1320,10 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of inaccessible databases in a logical server - /// - /// - /// 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 database. /// - /// - /// The name of the server. + /// + /// The requested database resource state. /// /// /// Headers that will be added to request. @@ -1299,7 +1346,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListInaccessibleByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1309,11 +1356,26 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1323,20 +1385,22 @@ internal DatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListInaccessibleByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/inaccessibleDatabases").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)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1345,7 +1409,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1376,6 +1440,12 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1396,7 +1466,7 @@ internal DatabasesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1431,7 +1501,7 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1444,7 +1514,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1456,232 +1526,23 @@ internal DatabasesOperations(SqlManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Upgrades a data warehouse. - /// - /// - /// 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 upgraded. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task UpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginUpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Renames 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 rename. - /// - /// - /// The resource move definition for renaming this database. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2020-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Rename", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move").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(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) + // Deserialize Response + if ((int)_statusCode == 201) { - foreach(var _header in customHeaders) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try + catch (JsonException ex) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) + _httpRequest.Dispose(); + if (_httpResponse != null) { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; + _httpResponse.Dispose(); } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { @@ -1691,7 +1552,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Exports a database. + /// Deletes the database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1703,9 +1564,6 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// The database export request parameters. - /// /// /// Headers that will be added to request. /// @@ -1715,9 +1573,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 /// @@ -1727,7 +1582,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1741,19 +1596,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1764,22 +1614,20 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/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}").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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1788,7 +1636,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1819,12 +1667,6 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1845,7 +1687,7 @@ internal DatabasesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1880,31 +1722,13 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1913,7 +1737,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Creates a new database or updates an existing database. + /// Updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1949,7 +1773,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1967,15 +1791,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1987,9 +1810,8 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -1999,9 +1821,9 @@ internal DatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2010,7 +1832,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2067,7 +1889,7 @@ internal DatabasesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2110,25 +1932,7 @@ 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 = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -2153,7 +1957,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Deletes the database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2163,7 +1967,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to be paused. /// /// /// Headers that will be added to request. @@ -2174,6 +1978,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 /// @@ -2183,7 +1990,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2201,7 +2008,10 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2212,21 +2022,20 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2235,7 +2044,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2286,7 +2095,7 @@ internal DatabasesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2321,13 +2130,31 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2336,7 +2163,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Updates an existing database. + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2346,10 +2173,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. - /// - /// - /// The requested database resource state. + /// The name of the database to be resumed. /// /// /// Headers that will be added to request. @@ -2372,7 +2196,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2386,15 +2210,14 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2405,22 +2228,20 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2429,7 +2250,7 @@ internal DatabasesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2460,12 +2281,6 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2554,7 +2369,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2564,7 +2379,11 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' /// /// /// Headers that will be added to request. @@ -2575,9 +2394,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 /// @@ -2587,7 +2403,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2605,7 +2421,10 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2616,21 +2435,25 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("replicaType", replicaType); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (replicaType != null) + { + _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2725,31 +2548,13 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2758,7 +2563,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Resumes a database. + /// Upgrades a data warehouse. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2768,7 +2573,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database to be upgraded. /// /// /// Headers that will be added to request. @@ -2779,9 +2584,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 /// @@ -2791,7 +2593,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2809,7 +2611,10 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2820,21 +2625,20 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpgradeDataWarehouse", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2929,31 +2733,13 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2962,7 +2748,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Failovers a database. + /// Imports a bacpac into a new database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2972,11 +2758,10 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to failover. + /// The name of the database. /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' + /// + /// The database import request parameters. /// /// /// Headers that will be added to request. @@ -2987,6 +2772,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 /// @@ -2996,7 +2784,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -3010,11 +2798,22 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3025,26 +2824,21 @@ 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); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (replicaType != null) - { - _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); - } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3084,6 +2878,12 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -3139,13 +2939,31 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -3154,7 +2972,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Upgrades a data warehouse. + /// Exports a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -3164,7 +2982,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 export request parameters. /// /// /// Headers that will be added to request. @@ -3175,6 +2996,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 /// @@ -3184,7 +3008,7 @@ internal DatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -3198,11 +3022,22 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3213,21 +3048,21 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpgradeDataWarehouse", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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}/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)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3267,6 +3102,12 @@ internal DatabasesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -3322,13 +3163,31 @@ internal DatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -3490,7 +3349,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3663,7 +3522,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3836,7 +3695,7 @@ internal DatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs index 4593e4f9f678..b6488b8725d5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,162 +21,6 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class DatabasesOperationsExtensions { - /// - /// Returns database metrics. - /// - /// - /// 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. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// - public static IEnumerable ListMetrics(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter) - { - return operations.ListMetricsAsync(resourceGroupName, serverName, databaseName, filter).GetAwaiter().GetResult(); - } - - /// - /// Returns database metrics. - /// - /// - /// 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. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// - /// - /// The cancellation token. - /// - public static async Task> ListMetricsAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns database metric definitions. - /// - /// - /// 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 IEnumerable ListMetricDefinitions(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.ListMetricDefinitionsAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Returns database metric definitions. - /// - /// - /// 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 Task> ListMetricDefinitionsAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListMetricDefinitionsWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - 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. - /// - /// - /// The database export request parameters. - /// - public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) - { - return 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 database export request parameters. - /// - /// - /// The cancellation token. - /// - public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Gets a list of databases. /// @@ -757,6 +599,60 @@ public static void Rename(this IDatabasesOperations operations, string resourceG (await operations.RenameWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// 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 database import request parameters. + /// + public static ImportExportOperationResult Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + { + return operations.ImportAsync(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 database import request parameters. + /// + /// + /// The cancellation token. + /// + public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Exports a database. /// @@ -776,9 +672,9 @@ public static void Rename(this IDatabasesOperations operations, string resourceG /// /// The database export request parameters. /// - public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) { - return operations.BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// @@ -803,9 +699,9 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// /// The cancellation token. /// - public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginExportWithHttpMessagesAsync(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; } @@ -1158,6 +1054,114 @@ public static void BeginUpgradeDataWarehouse(this IDatabasesOperations operation (await operations.BeginUpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// 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 database import request parameters. + /// + public static ImportExportOperationResult BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + { + return 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 database import request parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + 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. + /// + /// + /// The database export request parameters. + /// + public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + { + return operations.BeginExportAsync(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 database export request parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of databases. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs new file mode 100644 index 000000000000..ad1b84dfcf8b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs @@ -0,0 +1,1179 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedServersOperations operations. + /// + internal partial class DeletedServersOperations : IServiceOperations, IDeletedServersOperations + { + /// + /// Initializes a new instance of the DeletedServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedServersOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (deletedServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deletedServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("deletedServerName", deletedServerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{deletedServerName}", System.Uri.EscapeDataString(deletedServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRecoverWithHttpMessagesAsync(locationName, deletedServerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginRecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (deletedServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deletedServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("deletedServerName", deletedServerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRecover", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName}/recover").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{deletedServerName}", System.Uri.EscapeDataString(deletedServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs new file mode 100644 index 000000000000..c22369d18716 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs @@ -0,0 +1,275 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeletedServersOperations. + /// + public static partial class DeletedServersOperationsExtensions + { + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDeletedServersOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeletedServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer Get(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.GetAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Gets a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + public static IPage ListByLocation(this IDeletedServersOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IDeletedServersOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer Recover(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.RecoverAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task RecoverAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RecoverWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer BeginRecover(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.BeginRecoverAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRecoverAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRecoverWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDeletedServersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDeletedServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IDeletedServersOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IDeletedServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperationsExtensions.cs deleted file mode 100644 index 1a1ba60b08cd..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperationsExtensions.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ElasticPoolActivitiesOperations. - /// - public static partial class ElasticPoolActivitiesOperationsExtensions - { - /// - /// Returns elastic pool activities. - /// - /// - /// 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 elastic pool for which to get the current activity. - /// - public static IEnumerable ListByElasticPool(this IElasticPoolActivitiesOperations operations, string resourceGroupName, string serverName, string elasticPoolName) - { - return operations.ListByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName).GetAwaiter().GetResult(); - } - - /// - /// Returns elastic pool activities. - /// - /// - /// 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 elastic pool for which to get the current activity. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByElasticPoolAsync(this IElasticPoolActivitiesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperations.cs deleted file mode 100644 index 5ed89cf05671..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperations.cs +++ /dev/null @@ -1,258 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ElasticPoolDatabaseActivitiesOperations operations. - /// - internal partial class ElasticPoolDatabaseActivitiesOperations : IServiceOperations, IElasticPoolDatabaseActivitiesOperations - { - /// - /// Initializes a new instance of the ElasticPoolDatabaseActivitiesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ElasticPoolDatabaseActivitiesOperations(SqlManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SqlManagementClient - /// - public SqlManagementClient Client { get; private set; } - - /// - /// Returns activity on databases inside of an elastic pool. - /// - /// - /// 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 elastic pool. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (elasticPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); - } - string apiVersion = "2014-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs index 313d1a22cc51..451b8844247b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs @@ -101,7 +101,10 @@ internal ElasticPoolOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal ElasticPoolOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } @@ -126,9 +128,9 @@ internal ElasticPoolOperations(SqlManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -288,7 +290,10 @@ internal ElasticPoolOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -299,7 +304,6 @@ internal ElasticPoolOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", tracingParameters); } @@ -311,9 +315,9 @@ internal ElasticPoolOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -421,7 +425,7 @@ internal ElasticPoolOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -594,7 +598,7 @@ internal ElasticPoolOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs index 4ca474cdc783..587505c94fe1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs @@ -50,426 +50,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } - /// - /// Returns elastic pool metrics. - /// - /// - /// 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 elastic pool. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (elasticPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); - } - if (filter == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "filter"); - } - string apiVersion = "2014-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("filter", filter); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns elastic pool metric definitions. - /// - /// - /// 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 elastic pool. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (elasticPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); - } - string apiVersion = "2014-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinitions", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Gets all elastic pools in a server. /// @@ -504,7 +84,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, long? skip = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -518,7 +98,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -529,7 +112,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -544,9 +126,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -654,7 +236,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -725,7 +307,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -736,7 +321,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -748,9 +332,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1050,7 +634,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1062,7 +649,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1074,9 +660,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1276,7 +862,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1287,7 +876,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1299,9 +887,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1469,7 +1057,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1481,7 +1072,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1493,9 +1083,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1677,7 +1267,10 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1688,7 +1281,6 @@ internal ElasticPoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("elasticPoolName", elasticPoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } @@ -1700,9 +1292,9 @@ internal ElasticPoolsOperations(SqlManagementClient client) _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1965,7 +1557,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs index c7e88cca78b5..6ad82ede39ac 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,108 +21,6 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class ElasticPoolsOperationsExtensions { - /// - /// Returns elastic pool metrics. - /// - /// - /// 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 elastic pool. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// - public static IEnumerable ListMetrics(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string filter) - { - return operations.ListMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter).GetAwaiter().GetResult(); - } - - /// - /// Returns elastic pool metrics. - /// - /// - /// 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 elastic pool. - /// - /// - /// An OData filter expression that describes a subset of metrics to return. - /// - /// - /// The cancellation token. - /// - public static async Task> ListMetricsAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string filter, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns elastic pool metric definitions. - /// - /// - /// 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 elastic pool. - /// - public static IEnumerable ListMetricDefinitions(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, string elasticPoolName) - { - return operations.ListMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName).GetAwaiter().GetResult(); - } - - /// - /// Returns elastic pool metric definitions. - /// - /// - /// 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 elastic pool. - /// - /// - /// The cancellation token. - /// - public static async Task> ListMetricDefinitionsAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListMetricDefinitionsWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Gets all elastic pools in a server. /// @@ -141,7 +37,7 @@ public static IEnumerable ListMetricDefinitions(this IElasticP /// /// The number of elements in the collection to skip. /// - public static IPage ListByServer(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, int? skip = default(int?)) + public static IPage ListByServer(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, long? skip = default(long?)) { return operations.ListByServerAsync(resourceGroupName, serverName, skip).GetAwaiter().GetResult(); } @@ -165,7 +61,7 @@ public static IEnumerable ListMetricDefinitions(this IElasticP /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, long? skip = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, skip, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs index ccf56854ff71..726d8281a377 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs @@ -50,29 +50,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } - /// - /// Revalidates an existing encryption protector. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Gets a list of server encryption protectors /// @@ -118,7 +95,10 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -128,7 +108,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -139,9 +118,9 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -249,7 +228,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -313,8 +292,11 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +307,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -337,9 +318,9 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -503,6 +484,32 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// The name of the server. /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing encryption protector. + /// + /// + /// 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 requested encryption protector resource state. + /// + /// /// Headers that will be added to request. /// /// @@ -511,6 +518,9 @@ internal EncryptionProtectorsOperations(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 /// @@ -520,7 +530,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -530,12 +540,23 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,21 +567,21 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRevalidate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -569,7 +590,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -600,6 +621,12 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -655,13 +682,31 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -670,7 +715,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) } /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -679,9 +724,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// Headers that will be added to request. /// @@ -691,9 +733,6 @@ internal EncryptionProtectorsOperations(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 /// @@ -703,7 +742,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -713,20 +752,15 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -737,22 +771,20 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevalidate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -761,7 +793,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -792,12 +824,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -853,31 +879,13 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1039,7 +1047,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs index 2c36752cae66..a5410bcc1a5f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs @@ -21,45 +21,6 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class EncryptionProtectorsOperationsExtensions { - /// - /// Revalidates an existing encryption protector. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - public static void Revalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) - { - operations.RevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Revalidates an existing encryption protector. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task RevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.RevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Gets a list of server encryption protectors /// @@ -205,9 +166,9 @@ public static EncryptionProtector CreateOrUpdate(this IEncryptionProtectorsOpera /// /// The name of the server. /// - public static void BeginRevalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) + public static void Revalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) { - operations.BeginRevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + operations.RevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// @@ -226,9 +187,9 @@ public static void BeginRevalidate(this IEncryptionProtectorsOperations operatio /// /// The cancellation token. /// - public static async Task BeginRevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -279,6 +240,45 @@ public static EncryptionProtector BeginCreateOrUpdate(this IEncryptionProtectors } } + /// + /// Revalidates an existing encryption protector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + public static void BeginRevalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) + { + operations.BeginRevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Revalidates an existing encryption protector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets a list of server encryption protectors /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs index 31b9feff5f68..56ee20006aaa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs @@ -102,8 +102,11 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -320,8 +322,11 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -334,7 +339,6 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -347,9 +351,9 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -552,7 +556,10 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -563,7 +570,6 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -575,9 +581,9 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -685,7 +691,7 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -858,7 +864,7 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs index f82314c69e2e..5d627c614f0a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs @@ -95,8 +95,11 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -319,7 +321,10 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,7 +334,6 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -340,9 +344,9 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -450,7 +454,7 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -525,8 +529,11 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,7 +545,6 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client tracingParameters.Add("serverName", serverName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -550,9 +556,9 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -839,7 +845,7 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs index 38be0bb5beea..7832e89a6815 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs @@ -102,7 +102,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -383,7 +385,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -393,7 +398,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -404,9 +408,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -514,7 +518,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -649,7 +653,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -661,7 +668,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -673,9 +679,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -875,7 +881,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -886,7 +895,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -898,9 +906,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1068,7 +1076,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1080,7 +1091,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1092,9 +1102,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1279,7 +1289,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1290,7 +1303,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } @@ -1302,9 +1314,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1484,7 +1496,10 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1495,7 +1510,6 @@ internal FailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginForceFailoverAllowDataLoss", tracingParameters); } @@ -1507,9 +1521,9 @@ internal FailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1790,7 +1804,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs index b447cfb267e6..7eab0412a826 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs @@ -50,6 +50,212 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } + /// + /// Gets a firewall rule. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the firewall rule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("firewallRuleName", firewallRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates or updates a firewall rule. /// @@ -89,10 +295,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -109,11 +311,14 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,7 +326,6 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -132,14 +336,14 @@ internal FirewallRulesOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -323,10 +527,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -339,7 +539,14 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -347,7 +554,6 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -357,14 +563,14 @@ internal FirewallRulesOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -474,7 +680,7 @@ internal FirewallRulesOperations(SqlManagementClient client) } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -483,9 +689,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// Headers that will be added to request. /// @@ -507,12 +710,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -521,11 +720,14 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (firewallRuleName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -533,24 +735,21 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("firewallRuleName", firewallRuleName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -645,7 +844,7 @@ internal FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -658,7 +857,7 @@ internal FirewallRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -678,7 +877,7 @@ internal FirewallRulesOperations(SqlManagementClient client) } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -687,6 +886,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// /// /// Headers that will be added to request. /// @@ -708,12 +909,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ReplaceWithHttpMessagesAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -722,7 +919,18 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -730,23 +938,202 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -840,7 +1227,7 @@ internal FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs index f742b64361e6..347a30adc9a3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,6 +21,54 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class FirewallRulesOperationsExtensions { + /// + /// Gets a firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the firewall rule. + /// + public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + { + return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + } + + /// + /// Gets a firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates a firewall rule. /// @@ -123,7 +169,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The operations group for this extension method. @@ -135,16 +181,13 @@ public static void Delete(this IFirewallRulesOperations operations, string resou /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// - public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + public static IPage ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) { - return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The operations group for this extension method. @@ -156,22 +199,19 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The operations group for this extension method. @@ -183,13 +223,15 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// /// The name of the server. /// - public static IEnumerable ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static FirewallRule Replace(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, FirewallRuleList parameters) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.ReplaceAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The operations group for this extension method. @@ -201,12 +243,48 @@ public static IEnumerable ListByServer(this IFirewallRulesOperatio /// /// The name of the server. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ReplaceAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ReplaceWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IFirewallRulesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IFirewallRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs similarity index 60% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs index d40ebd0c11b6..d5fc224c479a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs @@ -19,12 +19,13 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DatabaseThreatDetectionPoliciesOperations operations. + /// DataWarehouseUserActivitiesOperations operations. /// - public partial interface IDatabaseThreatDetectionPoliciesOperations + public partial interface IDataWarehouseUserActivitiesOperations { /// - /// Gets a database's threat detection policy. + /// Gets the user activities of a data warehouse which includes running + /// and suspended queries /// /// /// The name of the resource group that contains the resource. You can @@ -35,8 +36,7 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy - /// is defined. + /// The name of the database. /// /// /// The headers that will be added to request. @@ -53,9 +53,10 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a database's threat detection policy. + /// List the user activities of a data warehouse which includes running + /// and suspended queries /// /// /// The name of the resource group that contains the resource. You can @@ -66,11 +67,30 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy - /// is defined. + /// The name of the database. /// - /// - /// The database Threat Detection policy. + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the user activities of a data warehouse which includes running + /// and suspended queries + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -87,6 +107,6 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IGeoBackupPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs similarity index 73% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IGeoBackupPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs index c5d989c62ba8..d03dd7947ca2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IGeoBackupPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// GeoBackupPoliciesOperations operations. + /// DatabaseAdvisorsOperations operations. /// - public partial interface IGeoBackupPoliciesOperations + public partial interface IDatabaseAdvisorsOperations { /// - /// Updates a database geo backup policy. + /// Gets a list of database advisors. /// /// /// The name of the resource group that contains the resource. You can @@ -37,9 +37,8 @@ public partial interface IGeoBackupPoliciesOperations /// /// The name of the database. /// - /// - /// The required parameters for creating or updating the geo backup - /// policy. + /// + /// The child resources to include in the response. /// /// /// The headers that will be added to request. @@ -56,9 +55,9 @@ public partial interface IGeoBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, GeoBackupPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a geo backup policy. + /// Gets a database advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -71,6 +70,9 @@ public partial interface IGeoBackupPoliciesOperations /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// /// /// The headers that will be added to request. /// @@ -86,9 +88,9 @@ public partial interface IGeoBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a list of geo backup policies. + /// Updates a database advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -101,6 +103,12 @@ public partial interface IGeoBackupPoliciesOperations /// /// The name of the database. /// + /// + /// The name of the Database Advisor. + /// + /// + /// The requested advisor resource state. + /// /// /// The headers that will be added to request. /// @@ -116,6 +124,6 @@ public partial interface IGeoBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs new file mode 100644 index 000000000000..422286104f56 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs @@ -0,0 +1,191 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseColumnsOperations operations. + /// + public partial interface IDatabaseColumnsOperations + { + /// + /// List database columns + /// + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database columns + /// + /// + /// 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 name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get database column + /// + /// + /// 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 name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerCommunicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs similarity index 67% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerCommunicationLinksOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs index fb9c5c458ed5..8d95be3ed384 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerCommunicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs @@ -19,12 +19,13 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServerCommunicationLinksOperations operations. + /// DatabaseExtensionsOperations operations. /// - public partial interface IServerCommunicationLinksOperations + public partial interface IDatabaseExtensionsOperations { /// - /// Deletes a server communication link. + /// Gets a database extension. This will return resource not found as + /// it is not supported. /// /// /// The name of the resource group that contains the resource. You can @@ -34,8 +35,10 @@ public partial interface IServerCommunicationLinksOperations /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// /// /// /// The headers that will be added to request. @@ -49,9 +52,9 @@ public partial interface IServerCommunicationLinksOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a server communication link. + /// Perform a database extension operation, like polybase import /// /// /// The name of the resource group that contains the resource. You can @@ -61,8 +64,13 @@ public partial interface IServerCommunicationLinksOperations /// /// The name of the server. /// - /// - /// The name of the server communication link. + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -79,9 +87,10 @@ public partial interface IServerCommunicationLinksOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is + /// not supported. /// /// /// The name of the resource group that contains the resource. You can @@ -91,11 +100,8 @@ public partial interface IServerCommunicationLinksOperations /// /// The name of the server. /// - /// - /// The name of the server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The name of the database. /// /// /// The headers that will be added to request. @@ -112,9 +118,9 @@ public partial interface IServerCommunicationLinksOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of server communication links. + /// Perform a database extension operation, like polybase import /// /// /// The name of the resource group that contains the resource. You can @@ -124,6 +130,14 @@ public partial interface IServerCommunicationLinksOperations /// /// The name of the server. /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The database import request parameters. + /// /// /// The headers that will be added to request. /// @@ -139,23 +153,13 @@ public partial interface IServerCommunicationLinksOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server communication link. + /// List database extension. This will return an empty list as it is + /// not supported. /// - /// - /// 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 server communication link. - /// - /// - /// The required parameters for creating a server communication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -172,6 +176,6 @@ public partial interface IServerCommunicationLinksOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string communicationLinkName, ServerCommunicationLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs new file mode 100644 index 000000000000..71b56d2b5327 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs @@ -0,0 +1,135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseRecommendedActionsOperations operations. + /// + public partial interface IDatabaseRecommendedActionsOperations + { + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseAdvisorWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a database recommended action. + /// + /// + /// 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 Database Advisor. + /// + /// + /// The name of Database Recommended Action. + /// + /// + /// The requested recommended action 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs similarity index 58% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs index 7fe33a73c74d..38091cb9738c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -19,12 +20,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ImportExportOperations operations. + /// DatabaseSchemasOperations operations. /// - public partial interface IImportExportOperations + public partial interface IDatabaseSchemasOperations { /// - /// Imports a bacpac into a new database. + /// List database schemas /// /// /// The name of the resource group that contains the resource. You can @@ -37,8 +38,8 @@ public partial interface IImportExportOperations /// /// The name of the database. /// - /// - /// The database import request parameters. + /// + /// OData parameters to apply to the operation. /// /// /// The headers that will be added to request. @@ -55,9 +56,9 @@ public partial interface IImportExportOperations /// /// Thrown when a required parameter is null /// - Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Imports a bacpac into a new database. + /// Get database schema /// /// /// The name of the resource group that contains the resource. You can @@ -70,8 +71,8 @@ public partial interface IImportExportOperations /// /// The name of the database. /// - /// - /// The database import request parameters. + /// + /// The name of the schema. /// /// /// The headers that will be added to request. @@ -88,6 +89,28 @@ public partial interface IImportExportOperations /// /// Thrown when a required parameter is null /// - Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs new file mode 100644 index 000000000000..55ebba8681d6 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSecurityAlertPoliciesOperations operations. + /// + public partial interface IDatabaseSecurityAlertPoliciesOperations + { + /// + /// Gets a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is + /// defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// 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 for which the security alert policy is + /// defined. + /// + /// + /// The database security alert policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of database's security alert policies. + /// + /// + /// 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 for which the security alert policy is + /// defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs new file mode 100644 index 000000000000..81491671ff47 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseTablesOperations operations. + /// + public partial interface IDatabaseTablesOperations + { + /// + /// List database tables + /// + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get database table + /// + /// + /// 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 name of the table. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs index bcec0cbe3391..d51b105d102b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IDatabaseUsagesOperations { /// - /// Returns database usages. + /// Gets database usages. /// /// /// The name of the resource group that contains the resource. You can @@ -52,6 +52,28 @@ public partial interface IDatabaseUsagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets database usages. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs index b311a0ba7e0e..5172fa305d44 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IDatabaseVulnerabilityAssessmentScansOperations { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The name of the resource group that contains the resource. You can @@ -37,6 +37,9 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The headers that will be added to request. /// @@ -46,15 +49,12 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The name of the resource group that contains the resource. You can @@ -67,9 +67,6 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The headers that will be added to request. /// @@ -85,9 +82,9 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The name of the resource group that contains the resource. You can @@ -112,10 +109,13 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Convert an existing scan result to a human readable format. If /// already exists nothing happens diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs index 99538f63d604..3675ccaa2b9c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs @@ -23,103 +23,6 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IDatabasesOperations { - /// - /// Returns database metrics. - /// - /// - /// 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. - /// - /// - /// An OData filter expression that describes a subset of metrics to - /// return. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns database metric definitions. - /// - /// - /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of databases. /// @@ -476,6 +379,39 @@ public partial interface IDatabasesOperations /// Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Exports a database. /// /// @@ -507,7 +443,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a new database or updates an existing database. /// @@ -720,6 +656,72 @@ public partial interface IDatabasesOperations /// Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets a list of databases. /// /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs new file mode 100644 index 000000000000..b73490e3caf6 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedServersOperations operations. + /// + public partial interface IDeletedServersOperations + { + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginRecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolDatabaseActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolDatabaseActivitiesOperations.cs deleted file mode 100644 index b0a0c73d3904..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolDatabaseActivitiesOperations.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ElasticPoolDatabaseActivitiesOperations operations. - /// - public partial interface IElasticPoolDatabaseActivitiesOperations - { - /// - /// Returns activity on databases inside of an elastic pool. - /// - /// - /// 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 elastic pool. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs index baeaed569f92..21bb34c07574 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs @@ -23,70 +23,6 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IElasticPoolsOperations { - /// - /// Returns elastic pool metrics. - /// - /// - /// 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 elastic pool. - /// - /// - /// An OData filter expression that describes a subset of metrics to - /// return. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns elastic pool metric definitions. - /// - /// - /// 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 elastic pool. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all elastic pools in a server. /// @@ -116,7 +52,7 @@ public partial interface IElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, long? skip = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets an elastic pool. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs index 954fcdf64391..039c28d94133 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IEncryptionProtectorsOperations { /// - /// Revalidates an existing encryption protector. + /// Gets a list of server encryption protectors /// /// /// The name of the resource group that contains the resource. You can @@ -43,12 +43,15 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of server encryption protectors + /// Gets a server encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -73,9 +76,9 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a server encryption protector. + /// Updates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -85,6 +88,9 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// + /// + /// The requested encryption protector resource state. + /// /// /// The headers that will be added to request. /// @@ -100,9 +106,9 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -112,9 +118,6 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// The headers that will be added to request. /// @@ -124,15 +127,12 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Revalidates an existing encryption protector. + /// Updates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -142,6 +142,9 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// + /// + /// The requested encryption protector resource state. + /// /// /// The headers that will be added to request. /// @@ -151,12 +154,15 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -166,9 +172,6 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// The headers that will be added to request. /// @@ -178,13 +181,10 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of server encryption protectors /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs index a8f402658f93..14ce7a8209f8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs @@ -23,6 +23,36 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IFirewallRulesOperations { + /// + /// Gets a firewall rule. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the firewall rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a firewall rule. /// @@ -84,7 +114,7 @@ public partial interface IFirewallRulesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The name of the resource group that contains the resource. You can @@ -94,9 +124,6 @@ public partial interface IFirewallRulesOperations /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The headers that will be added to request. /// @@ -112,9 +139,9 @@ public partial interface IFirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The name of the resource group that contains the resource. You can @@ -124,6 +151,30 @@ public partial interface IFirewallRulesOperations /// /// The name of the server. /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ReplaceWithHttpMessagesAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of firewall rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// @@ -139,6 +190,6 @@ public partial interface IFirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobExecutionsOperations.cs index a5fe7fe4058a..ec5a7eda5a1b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobExecutionsOperations.cs @@ -78,7 +78,7 @@ public partial interface IJobExecutionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByAgentWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByAgentWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Requests cancellation of a job execution. /// @@ -203,7 +203,7 @@ public partial interface IJobExecutionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByJobWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByJobWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a job execution. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobStepExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobStepExecutionsOperations.cs index ba6472843910..e55e945571e6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobStepExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobStepExecutionsOperations.cs @@ -84,7 +84,7 @@ public partial interface IJobStepExecutionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a step execution of a job execution. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobTargetExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobTargetExecutionsOperations.cs index fcc85a2daf87..acaec3094af1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobTargetExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IJobTargetExecutionsOperations.cs @@ -84,7 +84,7 @@ public partial interface IJobTargetExecutionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the target executions of a job step execution. /// @@ -149,7 +149,7 @@ public partial interface IJobTargetExecutionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByStepWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByStepWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a target execution. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILedgerDigestUploadsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILedgerDigestUploadsOperations.cs new file mode 100644 index 000000000000..1d4195a1be62 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILedgerDigestUploadsOperations.cs @@ -0,0 +1,173 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LedgerDigestUploadsOperations operations. + /// + public partial interface ILedgerDigestUploadsOperations + { + /// + /// Gets the current ledger digest upload configuration for 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Enables upload ledger digests to an Azure Storage account or an + /// Azure Confidential Ledger instance. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploads parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all ledger digest upload settings on 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Disables uploading ledger digests to an Azure Storage account or an + /// Azure Confidential Ledger instance. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> DisableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all ledger digest upload settings on a database. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs similarity index 71% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs index c56b71073b48..5f9104bef2db 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// TransparentDataEncryptionActivitiesOperations operations. + /// MaintenanceWindowOptionsOperations operations. /// - public partial interface ITransparentDataEncryptionActivitiesOperations + public partial interface IMaintenanceWindowOptionsOperations { /// - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// /// /// The name of the resource group that contains the resource. You can @@ -35,8 +35,10 @@ public partial interface ITransparentDataEncryptionActivitiesOperations /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption - /// applies. + /// The name of the database to get maintenance windows options for. + /// + /// + /// Maintenance window options name. /// /// /// The headers that will be added to request. @@ -53,6 +55,6 @@ public partial interface ITransparentDataEncryptionActivitiesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs similarity index 70% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs index 58bc6e583f64..5b17eb33c52a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceTierAdvisorsOperations operations. + /// MaintenanceWindowsOperations operations. /// - public partial interface IServiceTierAdvisorsOperations + public partial interface IMaintenanceWindowsOperations { /// - /// Gets a service tier advisor. + /// Gets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can @@ -35,10 +35,10 @@ public partial interface IServiceTierAdvisorsOperations /// The name of the server. /// /// - /// The name of database. + /// The name of the database to get maintenance windows for. /// - /// - /// The name of service tier advisor. + /// + /// Maintenance window name. /// /// /// The headers that will be added to request. @@ -55,9 +55,9 @@ public partial interface IServiceTierAdvisorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns service tier advisors for specified database. + /// Sets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can @@ -68,7 +68,12 @@ public partial interface IServiceTierAdvisorsOperations /// The name of the server. /// /// - /// The name of database. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. + /// + /// /// /// /// The headers that will be added to request. @@ -79,12 +84,9 @@ public partial interface IServiceTierAdvisorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs new file mode 100644 index 000000000000..4182457c18e5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs @@ -0,0 +1,191 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseColumnsOperations operations. + /// + public partial interface IManagedDatabaseColumnsOperations + { + /// + /// List managed database columns + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database columns + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get managed database column + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs new file mode 100644 index 000000000000..f7ed60b84147 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseQueriesOperations operations. + /// + public partial interface IManagedDatabaseQueriesOperations + { + /// + /// Get query by query id. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get query execution statistics by query id. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible + /// values include: 'PT1H', 'P1D' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByQueryWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get query execution statistics by query id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByQueryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs similarity index 64% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolActivitiesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs index dbff0a7219ff..dfcc7455253d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolActivitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -19,23 +19,26 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ElasticPoolActivitiesOperations operations. + /// ManagedDatabaseRecommendedSensitivityLabelsOperations operations. /// - public partial interface IElasticPoolActivitiesOperations + public partial interface IManagedDatabaseRecommendedSensitivityLabelsOperations { /// - /// Returns elastic pool activities. + /// Update recommended sensitivity labels states of a given database + /// using an operations batch. /// /// /// 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 managed instance. /// - /// - /// The name of the elastic pool for which to get the current activity. + /// + /// The name of the database. + /// + /// /// /// /// The headers that will be added to request. @@ -46,12 +49,9 @@ public partial interface IElasticPoolActivitiesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs new file mode 100644 index 000000000000..af0088a48da9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseSchemasOperations operations. + /// + public partial interface IManagedDatabaseSchemasOperations + { + /// + /// List managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get managed 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 managed instance. + /// + /// + /// 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed 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 + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs similarity index 62% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs index 12cfc4771a27..9a0980c928ac 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -19,26 +20,30 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DataMaskingPoliciesOperations operations. + /// ManagedDatabaseSecurityEventsOperations operations. /// - public partial interface IDataMaskingPoliciesOperations + public partial interface IManagedDatabaseSecurityEventsOperations { /// - /// Creates or updates a database data masking policy + /// Gets a list of security events. /// /// /// 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 managed instance. /// /// - /// The name of the database. + /// The name of the managed database for which the security events are + /// retrieved. /// - /// - /// Parameters for creating or updating a data masking policy. + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. /// /// /// The headers that will be added to request. @@ -55,20 +60,12 @@ public partial interface IDataMaskingPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a database data masking policy. + /// Gets a list of security events. /// - /// - /// 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 NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -85,6 +82,6 @@ public partial interface IDataMaskingPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs index c63e8601974e..be59cc99b7bc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs @@ -235,6 +235,10 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The headers that will be added to request. /// @@ -250,7 +254,37 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update sensitivity labels of a given database using an operations + /// batch. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The 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 a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -268,11 +302,11 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The headers that will be added to request. /// @@ -288,7 +322,7 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs new file mode 100644 index 000000000000..e5ed7fd9f9cf --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTablesOperations operations. + /// + public partial interface IManagedDatabaseTablesOperations + { + /// + /// List managed database tables + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get managed database table + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs new file mode 100644 index 000000000000..86510b1f0406 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTransparentDataEncryptionOperations operations. + /// + public partial interface IManagedDatabaseTransparentDataEncryptionOperations + { + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security alert + /// policy is defined. + /// + /// + /// The database transparent data encryption. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs index 1a5ca097c376..0857647fa574 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The name of the resource group that contains the resource. You can @@ -37,6 +37,9 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The headers that will be added to request. /// @@ -46,15 +49,13 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If + /// already exists nothing happens /// /// /// The name of the resource group that contains the resource. You can @@ -65,10 +66,10 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// /// /// The headers that will be added to request. @@ -85,9 +86,9 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// /// /// The name of the resource group that contains the resource. You can @@ -100,9 +101,6 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The headers that will be added to request. /// @@ -112,13 +110,15 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Convert an existing scan result to a human readable format. If - /// already exists nothing happens + /// Gets a vulnerability assessment scan record of a database. /// /// /// The name of the resource group that contains the resource. You can @@ -129,10 +129,10 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// /// /// The headers that will be added to request. @@ -149,7 +149,7 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Executes a Vulnerability Assessment database scan. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs index 59ad2243810f..ba0f47d7a840 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedInstanceOperations { /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The name of the resource group that contains the resource. You can @@ -34,8 +34,6 @@ public partial interface IManagedInstanceOperations /// /// The name of the managed instance. /// - /// - /// /// /// The headers that will be added to request. /// @@ -45,12 +43,15 @@ public partial interface IManagedInstanceOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The name of the resource group that contains the resource. You can @@ -60,6 +61,8 @@ public partial interface IManagedInstanceOperations /// /// The name of the managed instance. /// + /// + /// /// /// The headers that will be added to request. /// @@ -75,9 +78,9 @@ public partial interface IManagedInstanceOperations /// /// Thrown when a required parameter is null /// - Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The name of the resource group that contains the resource. You can @@ -98,13 +101,10 @@ public partial interface IManagedInstanceOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of operations performed on the managed instance. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..b08a5f11ed82 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateEndpointConnectionsOperations operations. + /// + public partial interface IManagedInstancePrivateEndpointConnectionsOperations + { + /// + /// Gets a private endpoint connection. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs similarity index 56% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingRulesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs index f12264829ad4..524381ac025b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataMaskingRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs @@ -19,30 +19,20 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DataMaskingRulesOperations operations. + /// ManagedInstancePrivateLinkResourcesOperations operations. /// - public partial interface IDataMaskingRulesOperations + public partial interface IManagedInstancePrivateLinkResourcesOperations { /// - /// Creates or updates a database data masking rule. + /// Gets the private link resources for SQL server. /// /// /// 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 data masking rule. - /// - /// - /// The required parameters for creating or updating a data masking - /// rule. + /// + /// The name of the managed instance. /// /// /// The headers that will be added to request. @@ -59,20 +49,42 @@ public partial interface IDataMaskingRulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of database data masking rules. + /// Gets a private link resource for SQL server. /// /// /// 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 managed instance. /// - /// - /// The name of the database. + /// + /// The name of the private link resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -89,6 +101,6 @@ public partial interface IDataMaskingRulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs index 22d58340a52f..36420cc7522b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs @@ -34,6 +34,31 @@ public partial interface IManagedInstancesOperations /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -49,7 +74,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of managed instances in a resource group. /// @@ -58,6 +83,9 @@ public partial interface IManagedInstancesOperations /// obtain this value from the Azure Resource Manager API or the /// portal. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -73,7 +101,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a managed instance. /// @@ -85,6 +113,9 @@ public partial interface IManagedInstancesOperations /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -100,7 +131,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a managed instance. /// @@ -266,25 +297,6 @@ public partial interface IManagedInstancesOperations /// Task FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Creates or updates a managed instance. /// /// @@ -419,7 +431,7 @@ public partial interface IManagedInstancesOperations /// Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -439,9 +451,9 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -461,9 +473,9 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The NextLink from the previous successful call to List operation. @@ -483,6 +495,6 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs index 262e36247210..9d1a736d24dc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs @@ -53,7 +53,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can @@ -66,7 +66,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -85,7 +85,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can @@ -98,7 +98,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -146,7 +146,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task>> ListByRestorableDroppedDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can @@ -159,7 +159,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -178,7 +178,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can @@ -191,7 +191,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceObjectivesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs similarity index 58% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceObjectivesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs index 47cb5277bf94..a0e5940019b3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceObjectivesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs @@ -19,23 +19,15 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceObjectivesOperations operations. + /// OperationsHealthOperations operations. /// - public partial interface IServiceObjectivesOperations + public partial interface IOperationsHealthOperations { /// - /// Gets a database service objective. + /// Gets a service operation health status. /// - /// - /// 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 service objective to retrieve. + /// + /// The name of the region where the resource is located. /// /// /// The headers that will be added to request. @@ -52,17 +44,12 @@ public partial interface IServiceObjectivesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string serviceObjectiveName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns database service objectives. + /// Gets a service operation health status. /// - /// - /// 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 NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -79,6 +66,6 @@ public partial interface IServiceObjectivesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOutboundFirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOutboundFirewallRulesOperations.cs new file mode 100644 index 000000000000..aa5e54b2ad24 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOutboundFirewallRulesOperations.cs @@ -0,0 +1,215 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OutboundFirewallRulesOperations operations. + /// + public partial interface IOutboundFirewallRulesOperations + { + /// + /// Gets an outbound firewall rule. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs similarity index 68% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerUsagesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs index fc5698db6a3f..51b7acd4b03d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs @@ -19,12 +19,13 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServerUsagesOperations operations. + /// RecommendedSensitivityLabelsOperations operations. /// - public partial interface IServerUsagesOperations + public partial interface IRecommendedSensitivityLabelsOperations { /// - /// Returns server usages. + /// Update recommended sensitivity labels states of a given database + /// using an operations batch. /// /// /// The name of the resource group that contains the resource. You can @@ -34,6 +35,11 @@ public partial interface IServerUsagesOperations /// /// The name of the server. /// + /// + /// The name of the database. + /// + /// + /// /// /// The headers that will be added to request. /// @@ -43,12 +49,9 @@ public partial interface IServerUsagesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecoverableDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecoverableDatabasesOperations.cs deleted file mode 100644 index 0cd6b02fd596..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecoverableDatabasesOperations.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RecoverableDatabasesOperations operations. - /// - public partial interface IRecoverableDatabasesOperations - { - /// - /// Gets a recoverable database, which is a resource representing a - /// database's geo backup - /// - /// - /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of recoverable databases - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs index 7948b2f9f559..c2ddb46abaa1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs @@ -24,8 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IReplicationLinksOperations { /// - /// Deletes a database replication link. Cannot be done during - /// failover. + /// Gets a list of replication links on database. /// /// /// The name of the resource group that contains the resource. You can @@ -33,44 +32,10 @@ public partial interface IReplicationLinksOperations /// portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database that has the replication link to be - /// dropped. - /// - /// - /// The ID of the replication link to be deleted. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a database replication link. - /// - /// - /// 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 get the link for. - /// - /// - /// The replication link ID to be retrieved. + /// The name of the database containing the replication link. /// /// /// The headers that will be added to request. @@ -87,43 +52,9 @@ public partial interface IReplicationLinksOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Sets which replica database is primary by failing over from the - /// current primary replica 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 that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. This operation might result in - /// data loss. + /// Gets a replication link. /// /// /// The name of the resource group that contains the resource. You can @@ -131,14 +62,13 @@ public partial interface IReplicationLinksOperations /// portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database that has the replication link to be failed - /// over. + /// The name of the database containing the replication link. /// - /// - /// The ID of the replication link to be failed over. + /// + /// The name of the replication link. /// /// /// The headers that will be added to request. @@ -149,46 +79,15 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// 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 that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code + /// + /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// - Task UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists a database's replication links. + /// Gets a list of replication links. /// /// /// The name of the resource group that contains the resource. You can @@ -196,10 +95,7 @@ public partial interface IReplicationLinksOperations /// portal. /// /// - /// The name of the server. - /// - /// - /// The name of the database to retrieve links for. + /// The name of the server containing the replication link. /// /// /// The headers that will be added to request. @@ -216,25 +112,12 @@ public partial interface IReplicationLinksOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. + /// Gets a list of replication links on 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 that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -245,63 +128,18 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. This operation might result in - /// data loss. - /// - /// - /// 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 that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code + /// + /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// - Task BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links. /// - /// - /// 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 that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -312,9 +150,12 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginUnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs index 5ec52bad2f2c..62e67d934134 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IRestorableDroppedDatabasesOperations { /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The name of the resource group that contains the resource. You can @@ -34,10 +34,6 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// The headers that will be added to request. /// @@ -53,9 +49,9 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The name of the resource group that contains the resource. You can @@ -65,6 +61,30 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// The name of the server. /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// @@ -80,6 +100,6 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs index b68a63292c1f..2ce3f914bf40 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs @@ -52,7 +52,7 @@ public partial interface IRestorePointsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a restore point for a data warehouse. /// @@ -182,5 +182,27 @@ public partial interface IRestorePointsOperations /// Thrown when a required parameter is null /// Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, CreateDatabaseRestorePointDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of database restore points. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs index bc4c9920da28..ad73f817a983 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs @@ -41,6 +41,10 @@ public partial interface ISensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The headers that will be added to request. /// @@ -56,7 +60,37 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update sensitivity labels of a given database using an operations + /// batch. + /// + /// + /// 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 a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -74,11 +108,11 @@ public partial interface ISensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The headers that will be added to request. /// @@ -94,7 +128,7 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Enables sensitivity recommendations on a given column /// (recommendations are enabled by default on all columns) diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs similarity index 72% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs index 77e7dd819296..827ee7026f6f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// RecommendedElasticPoolsOperations operations. + /// ServerAdvisorsOperations operations. /// - public partial interface IRecommendedElasticPoolsOperations + public partial interface IServerAdvisorsOperations { /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The name of the resource group that contains the resource. You can @@ -34,8 +34,8 @@ public partial interface IRecommendedElasticPoolsOperations /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// /// /// The headers that will be added to request. @@ -52,9 +52,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -64,6 +64,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// The headers that will be added to request. /// @@ -79,9 +82,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -91,8 +94,11 @@ public partial interface IRecommendedElasticPoolsOperations /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The name of the Server Advisor. + /// + /// + /// The requested advisor resource state. /// /// /// The headers that will be added to request. @@ -109,6 +115,6 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs index 900258bc9aee..f6ab85e1a643 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs @@ -35,7 +35,7 @@ public partial interface IServerDnsAliasesOperations /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -54,7 +54,7 @@ public partial interface IServerDnsAliasesOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can @@ -65,7 +65,7 @@ public partial interface IServerDnsAliasesOperations /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -95,7 +95,7 @@ public partial interface IServerDnsAliasesOperations /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -162,12 +162,15 @@ public partial interface IServerDnsAliasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can @@ -178,7 +181,7 @@ public partial interface IServerDnsAliasesOperations /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -208,7 +211,7 @@ public partial interface IServerDnsAliasesOperations /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -248,10 +251,13 @@ public partial interface IServerDnsAliasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of server DNS aliases for a server. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs index a64b4dbeb517..d5d088798d8f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs @@ -95,9 +95,9 @@ public partial interface IServerKeysOperations /// The name of the server key to be operated on (updated or created). /// The key name is required to be in the format of /// 'vault_key_version'. For example, if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -160,9 +160,9 @@ public partial interface IServerKeysOperations /// The name of the server key to be operated on (updated or created). /// The key name is required to be in the format of /// 'vault_key_version'. For example, if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs similarity index 71% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IUsagesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs index 44f93d890c7e..e71dd1acac1b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs @@ -19,24 +19,20 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// UsagesOperations operations. + /// ServerOperations operations. /// - public partial interface IUsagesOperations + public partial interface IServerOperations { /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// 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 instance pool to be retrieved. - /// - /// - /// Optional request parameter to include managed instance usages - /// within the instance pool. + /// + /// The name of the server. /// /// /// The headers that will be added to request. @@ -53,9 +49,9 @@ public partial interface IUsagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, bool? expandChildren = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The NextLink from the previous successful call to List operation. @@ -75,6 +71,6 @@ public partial interface IUsagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs index 591f10e968ab..af2e8ec99076 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs @@ -31,6 +31,9 @@ public partial interface IServersOperations /// obtain this value from the Azure Resource Manager API or the /// portal. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -46,7 +49,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a server. /// @@ -58,6 +61,9 @@ public partial interface IServersOperations /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -73,7 +79,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a server. /// @@ -161,6 +167,9 @@ public partial interface IServersOperations /// /// Gets a list of all servers in the subscription. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -176,13 +185,20 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Determines whether a resource can be created with the specified - /// name. + /// 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 availability request parameters. + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -199,20 +215,13 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified + /// name. /// - /// - /// 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 database import request parameters. + /// The name availability request parameters. /// /// /// The headers that will be added to request. @@ -229,7 +238,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a server. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerConnectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs similarity index 72% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerConnectionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs index 83d40613d8a8..bd09e50b6f46 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerConnectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs @@ -19,23 +19,20 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServerConnectionPoliciesOperations operations. + /// SqlAgentOperations operations. /// - public partial interface IServerConnectionPoliciesOperations + public partial interface ISqlAgentOperations { /// - /// Creates or updates the server's connection policy. + /// Gets current instance sql agent configuration. /// /// /// 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 required parameters for updating a secure connection policy. + /// + /// The name of the managed instance. /// /// /// The headers that will be added to request. @@ -52,17 +49,19 @@ public partial interface IServerConnectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerConnectionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the server's secure connection policy. + /// Puts new sql agent configuration to instance. /// /// /// The name of the resource group that contains the resource. You can /// obtain this value from the Azure Resource Manager API or the /// portal. /// - /// - /// The name of the server. + /// + /// The name of the managed instance. + /// + /// /// /// /// The headers that will be added to request. @@ -79,6 +78,6 @@ public partial interface IServerConnectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs index 0f57e4aa7fe3..9b7f132c720c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -43,6 +43,11 @@ public partial interface ISqlManagementClient : System.IDisposable /// ServiceClientCredentials Credentials { get; } + /// + /// The API version to use for the request. + /// + string ApiVersion { get; } + /// /// The subscription ID that identifies an Azure subscription. /// @@ -68,114 +73,119 @@ public partial interface ISqlManagementClient : System.IDisposable /// - /// Gets the IRecoverableDatabasesOperations. + /// Gets the IBackupShortTermRetentionPoliciesOperations. /// - IRecoverableDatabasesOperations RecoverableDatabases { get; } + IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; } /// - /// Gets the IRestorableDroppedDatabasesOperations. + /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. /// - IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } + IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; } /// - /// Gets the IServerConnectionPoliciesOperations. + /// Gets the IExtendedServerBlobAuditingPoliciesOperations. /// - IServerConnectionPoliciesOperations ServerConnectionPolicies { get; } + IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; } /// - /// Gets the IDatabaseThreatDetectionPoliciesOperations. + /// Gets the IServerBlobAuditingPoliciesOperations. /// - IDatabaseThreatDetectionPoliciesOperations DatabaseThreatDetectionPolicies { get; } + IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; } /// - /// Gets the IDataMaskingPoliciesOperations. + /// Gets the IDatabaseBlobAuditingPoliciesOperations. /// - IDataMaskingPoliciesOperations DataMaskingPolicies { get; } + IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; } /// - /// Gets the IDataMaskingRulesOperations. + /// Gets the IDataWarehouseUserActivitiesOperations. /// - IDataMaskingRulesOperations DataMaskingRules { get; } + IDataWarehouseUserActivitiesOperations DataWarehouseUserActivities { get; } /// - /// Gets the IFirewallRulesOperations. + /// Gets the IDatabaseAdvisorsOperations. /// - IFirewallRulesOperations FirewallRules { get; } + IDatabaseAdvisorsOperations DatabaseAdvisors { get; } /// - /// Gets the IGeoBackupPoliciesOperations. + /// Gets the IDatabaseAutomaticTuningOperations. /// - IGeoBackupPoliciesOperations GeoBackupPolicies { get; } + IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; } /// - /// Gets the IDatabasesOperations. + /// Gets the IDatabaseColumnsOperations. /// - IDatabasesOperations Databases { get; } + IDatabaseColumnsOperations DatabaseColumns { get; } /// - /// Gets the IElasticPoolsOperations. + /// Gets the IDatabaseExtensionsOperations. /// - IElasticPoolsOperations ElasticPools { get; } + IDatabaseExtensionsOperations DatabaseExtensions { get; } /// - /// Gets the IRecommendedElasticPoolsOperations. + /// Gets the IDatabaseOperations. /// - IRecommendedElasticPoolsOperations RecommendedElasticPools { get; } + IDatabaseOperations DatabaseOperations { get; } /// - /// Gets the IReplicationLinksOperations. + /// Gets the IDatabaseRecommendedActionsOperations. /// - IReplicationLinksOperations ReplicationLinks { get; } + IDatabaseRecommendedActionsOperations DatabaseRecommendedActions { get; } /// - /// Gets the IServerCommunicationLinksOperations. + /// Gets the IDatabaseSchemasOperations. /// - IServerCommunicationLinksOperations ServerCommunicationLinks { get; } + IDatabaseSchemasOperations DatabaseSchemas { get; } /// - /// Gets the IServiceObjectivesOperations. + /// Gets the IDatabaseSecurityAlertPoliciesOperations. /// - IServiceObjectivesOperations ServiceObjectives { get; } + IDatabaseSecurityAlertPoliciesOperations DatabaseSecurityAlertPolicies { get; } /// - /// Gets the IElasticPoolActivitiesOperations. + /// Gets the IDatabaseTablesOperations. /// - IElasticPoolActivitiesOperations ElasticPoolActivities { get; } + IDatabaseTablesOperations DatabaseTables { get; } /// - /// Gets the IElasticPoolDatabaseActivitiesOperations. + /// Gets the IDatabaseUsagesOperations. /// - IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; } + IDatabaseUsagesOperations DatabaseUsages { get; } /// - /// Gets the IServiceTierAdvisorsOperations. + /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// - IServiceTierAdvisorsOperations ServiceTierAdvisors { get; } + IDatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines { get; } /// - /// Gets the ITransparentDataEncryptionsOperations. + /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. /// - ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; } + IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; } /// - /// Gets the ITransparentDataEncryptionActivitiesOperations. + /// Gets the IDatabaseVulnerabilityAssessmentsOperations. /// - ITransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities { get; } + IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; } /// - /// Gets the IServerUsagesOperations. + /// Gets the IDatabasesOperations. /// - IServerUsagesOperations ServerUsages { get; } + IDatabasesOperations Databases { get; } /// - /// Gets the IDatabaseUsagesOperations. + /// Gets the IDeletedServersOperations. /// - IDatabaseUsagesOperations DatabaseUsages { get; } + IDeletedServersOperations DeletedServers { get; } /// - /// Gets the IDatabaseAutomaticTuningOperations. + /// Gets the IElasticPoolOperations. /// - IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; } + IElasticPoolOperations ElasticPoolOperations { get; } + + /// + /// Gets the IElasticPoolsOperations. + /// + IElasticPoolsOperations ElasticPools { get; } /// /// Gets the IEncryptionProtectorsOperations. @@ -188,254 +198,259 @@ public partial interface ISqlManagementClient : System.IDisposable IFailoverGroupsOperations FailoverGroups { get; } /// - /// Gets the IOperations. + /// Gets the IFirewallRulesOperations. /// - IOperations Operations { get; } + IFirewallRulesOperations FirewallRules { get; } /// - /// Gets the IServerKeysOperations. + /// Gets the IInstanceFailoverGroupsOperations. /// - IServerKeysOperations ServerKeys { get; } + IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; } /// - /// Gets the ISyncAgentsOperations. + /// Gets the IInstancePoolsOperations. /// - ISyncAgentsOperations SyncAgents { get; } + IInstancePoolsOperations InstancePools { get; } /// - /// Gets the ISubscriptionUsagesOperations. + /// Gets the IJobAgentsOperations. /// - ISubscriptionUsagesOperations SubscriptionUsages { get; } + IJobAgentsOperations JobAgents { get; } /// - /// Gets the IVirtualClustersOperations. + /// Gets the IJobCredentialsOperations. /// - IVirtualClustersOperations VirtualClusters { get; } + IJobCredentialsOperations JobCredentials { get; } /// - /// Gets the IVirtualNetworkRulesOperations. + /// Gets the IJobExecutionsOperations. /// - IVirtualNetworkRulesOperations VirtualNetworkRules { get; } + IJobExecutionsOperations JobExecutions { get; } /// - /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. + /// Gets the IJobStepExecutionsOperations. /// - IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; } + IJobStepExecutionsOperations JobStepExecutions { get; } /// - /// Gets the IExtendedServerBlobAuditingPoliciesOperations. + /// Gets the IJobStepsOperations. /// - IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; } + IJobStepsOperations JobSteps { get; } /// - /// Gets the IServerBlobAuditingPoliciesOperations. + /// Gets the IJobTargetExecutionsOperations. /// - IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; } + IJobTargetExecutionsOperations JobTargetExecutions { get; } /// - /// Gets the IDatabaseBlobAuditingPoliciesOperations. + /// Gets the IJobTargetGroupsOperations. /// - IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; } + IJobTargetGroupsOperations JobTargetGroups { get; } /// - /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IJobVersionsOperations. /// - IDatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines { get; } + IJobVersionsOperations JobVersions { get; } /// - /// Gets the IDatabaseVulnerabilityAssessmentsOperations. + /// Gets the IJobsOperations. /// - IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; } + IJobsOperations Jobs { get; } /// - /// Gets the IJobAgentsOperations. + /// Gets the ILedgerDigestUploadsOperations. /// - IJobAgentsOperations JobAgents { get; } + ILedgerDigestUploadsOperations LedgerDigestUploads { get; } /// - /// Gets the IJobCredentialsOperations. + /// Gets the ICapabilitiesOperations. /// - IJobCredentialsOperations JobCredentials { get; } + ICapabilitiesOperations Capabilities { get; } /// - /// Gets the IJobExecutionsOperations. + /// Gets the ILongTermRetentionBackupsOperations. /// - IJobExecutionsOperations JobExecutions { get; } + ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } /// - /// Gets the IJobsOperations. + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. /// - IJobsOperations Jobs { get; } + ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } /// - /// Gets the IJobStepExecutionsOperations. + /// Gets the ILongTermRetentionPoliciesOperations. /// - IJobStepExecutionsOperations JobStepExecutions { get; } + ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; } /// - /// Gets the IJobStepsOperations. + /// Gets the IMaintenanceWindowOptionsOperations. /// - IJobStepsOperations JobSteps { get; } + IMaintenanceWindowOptionsOperations MaintenanceWindowOptions { get; } /// - /// Gets the IJobTargetExecutionsOperations. + /// Gets the IMaintenanceWindowsOperations. /// - IJobTargetExecutionsOperations JobTargetExecutions { get; } + IMaintenanceWindowsOperations MaintenanceWindows { get; } /// - /// Gets the IJobTargetGroupsOperations. + /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// - IJobTargetGroupsOperations JobTargetGroups { get; } + IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; } /// - /// Gets the IJobVersionsOperations. + /// Gets the IManagedDatabaseColumnsOperations. /// - IJobVersionsOperations JobVersions { get; } + IManagedDatabaseColumnsOperations ManagedDatabaseColumns { get; } /// - /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedDatabaseQueriesOperations. /// - IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; } + IManagedDatabaseQueriesOperations ManagedDatabaseQueries { get; } /// - /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedDatabaseRestoreDetailsOperations. /// - IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; } + IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; } /// - /// Gets the IServerAutomaticTuningOperations. + /// Gets the IManagedDatabaseSchemasOperations. /// - IServerAutomaticTuningOperations ServerAutomaticTuning { get; } + IManagedDatabaseSchemasOperations ManagedDatabaseSchemas { get; } /// - /// Gets the IServerDnsAliasesOperations. + /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. /// - IServerDnsAliasesOperations ServerDnsAliases { get; } + IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseSecurityEventsOperations. /// - IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } + IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; } /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// Gets the IManagedDatabaseSensitivityLabelsOperations. /// - IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } + IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } /// - /// Gets the IRestorePointsOperations. + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. /// - IRestorePointsOperations RestorePoints { get; } + IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; } /// - /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseTablesOperations. /// - IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; } + IManagedDatabaseTablesOperations ManagedDatabaseTables { get; } /// - /// Gets the IManagedServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseTransparentDataEncryptionOperations. /// - IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; } + IManagedDatabaseTransparentDataEncryptionOperations ManagedDatabaseTransparentDataEncryption { get; } /// - /// Gets the ISensitivityLabelsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// - ISensitivityLabelsOperations SensitivityLabels { get; } + IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; } /// - /// Gets the IManagedInstanceAdministratorsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. /// - IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; } + IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; } /// - /// Gets the IDatabaseOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. /// - IDatabaseOperations DatabaseOperations { get; } + IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; } /// - /// Gets the IElasticPoolOperations. + /// Gets the IManagedDatabasesOperations. /// - IElasticPoolOperations ElasticPoolOperations { get; } + IManagedDatabasesOperations ManagedDatabases { get; } /// - /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedInstanceAdministratorsOperations. /// - IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; } + IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. /// - IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; } + IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedInstanceEncryptionProtectorsOperations. /// - IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; } + IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. + /// Gets the IManagedInstanceKeysOperations. /// - IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; } + IManagedInstanceKeysOperations ManagedInstanceKeys { get; } /// - /// Gets the IInstanceFailoverGroupsOperations. + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. /// - IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; } + IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; } /// - /// Gets the ITdeCertificatesOperations. + /// Gets the IManagedInstanceOperations. /// - ITdeCertificatesOperations TdeCertificates { get; } + IManagedInstanceOperations ManagedInstanceOperations { get; } /// - /// Gets the IManagedInstanceTdeCertificatesOperations. + /// Gets the IManagedInstancePrivateEndpointConnectionsOperations. /// - IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; } + IManagedInstancePrivateEndpointConnectionsOperations ManagedInstancePrivateEndpointConnections { get; } /// - /// Gets the IManagedInstanceKeysOperations. + /// Gets the IManagedInstancePrivateLinkResourcesOperations. /// - IManagedInstanceKeysOperations ManagedInstanceKeys { get; } + IManagedInstancePrivateLinkResourcesOperations ManagedInstancePrivateLinkResources { get; } /// - /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// Gets the IManagedInstanceTdeCertificatesOperations. /// - IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; } + IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; } /// - /// Gets the IRecoverableManagedDatabasesOperations. + /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. /// - IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; } + IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; } /// - /// Gets the IBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedInstancesOperations. /// - IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; } + IManagedInstancesOperations ManagedInstances { get; } /// - /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. + /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. /// - IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; } + IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; } /// - /// Gets the IServerVulnerabilityAssessmentsOperations. + /// Gets the IManagedServerSecurityAlertPoliciesOperations. /// - IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; } + IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; } /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// Gets the IOperations. /// - IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } + IOperations Operations { get; } /// - /// Gets the IInstancePoolsOperations. + /// Gets the IOperationsHealthOperations. /// - IInstancePoolsOperations InstancePools { get; } + IOperationsHealthOperations OperationsHealth { get; } /// - /// Gets the IUsagesOperations. + /// Gets the IOutboundFirewallRulesOperations. /// - IUsagesOperations Usages { get; } + IOutboundFirewallRulesOperations OutboundFirewallRules { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } /// /// Gets the IPrivateLinkResourcesOperations. @@ -443,84 +458,84 @@ public partial interface ISqlManagementClient : System.IDisposable IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IServersOperations. + /// Gets the IRecoverableManagedDatabasesOperations. /// - IServersOperations Servers { get; } + IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; } /// - /// Gets the ICapabilitiesOperations. + /// Gets the IReplicationLinksOperations. /// - ICapabilitiesOperations Capabilities { get; } + IReplicationLinksOperations ReplicationLinks { get; } /// - /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// Gets the IRestorableDroppedDatabasesOperations. /// - ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } + IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } /// - /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// Gets the IRestorableDroppedManagedDatabasesOperations. /// - IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; } + IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } /// - /// Gets the IWorkloadGroupsOperations. + /// Gets the IRestorePointsOperations. /// - IWorkloadGroupsOperations WorkloadGroups { get; } + IRestorePointsOperations RestorePoints { get; } /// - /// Gets the IWorkloadClassifiersOperations. + /// Gets the ISensitivityLabelsOperations. /// - IWorkloadClassifiersOperations WorkloadClassifiers { get; } + ISensitivityLabelsOperations SensitivityLabels { get; } /// - /// Gets the IManagedInstanceOperations. + /// Gets the IRecommendedSensitivityLabelsOperations. /// - IManagedInstanceOperations ManagedInstanceOperations { get; } + IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; } /// - /// Gets the IServerAzureADAdministratorsOperations. + /// Gets the IServerAdvisorsOperations. /// - IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } + IServerAdvisorsOperations ServerAdvisors { get; } /// - /// Gets the ISyncGroupsOperations. + /// Gets the IServerAutomaticTuningOperations. /// - ISyncGroupsOperations SyncGroups { get; } + IServerAutomaticTuningOperations ServerAutomaticTuning { get; } /// - /// Gets the ISyncMembersOperations. + /// Gets the IServerAzureADAdministratorsOperations. /// - ISyncMembersOperations SyncMembers { get; } + IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } /// - /// Gets the IImportExportOperations. + /// Gets the IServerAzureADOnlyAuthenticationsOperations. /// - IImportExportOperations ImportExport { get; } + IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; } /// - /// Gets the IManagedDatabasesOperations. + /// Gets the IServerDevOpsAuditSettingsOperations. /// - IManagedDatabasesOperations ManagedDatabases { get; } + IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; } /// - /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// Gets the IServerDnsAliasesOperations. /// - IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; } + IServerDnsAliasesOperations ServerDnsAliases { get; } /// - /// Gets the IServerAzureADOnlyAuthenticationsOperations. + /// Gets the IServerKeysOperations. /// - IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; } + IServerKeysOperations ServerKeys { get; } /// - /// Gets the IManagedInstancesOperations. + /// Gets the IServerOperations. /// - IManagedInstancesOperations ManagedInstances { get; } + IServerOperations ServerOperations { get; } /// - /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. + /// Gets the IServerSecurityAlertPoliciesOperations. /// - IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; } + IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } /// /// Gets the IServerTrustGroupsOperations. @@ -528,24 +543,74 @@ public partial interface ISqlManagementClient : System.IDisposable IServerTrustGroupsOperations ServerTrustGroups { get; } /// - /// Gets the IServerDevOpsAuditSettingsOperations. + /// Gets the IServerVulnerabilityAssessmentsOperations. /// - IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; } + IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; } /// - /// Gets the ILongTermRetentionBackupsOperations. + /// Gets the IServersOperations. /// - ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } + IServersOperations Servers { get; } /// - /// Gets the ILongTermRetentionPoliciesOperations. + /// Gets the ISqlAgentOperations. /// - ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; } + ISqlAgentOperations SqlAgent { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the ISubscriptionUsagesOperations. /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + ISubscriptionUsagesOperations SubscriptionUsages { get; } + + /// + /// Gets the ISyncAgentsOperations. + /// + ISyncAgentsOperations SyncAgents { get; } + + /// + /// Gets the ISyncGroupsOperations. + /// + ISyncGroupsOperations SyncGroups { get; } + + /// + /// Gets the ISyncMembersOperations. + /// + ISyncMembersOperations SyncMembers { get; } + + /// + /// Gets the ITdeCertificatesOperations. + /// + ITdeCertificatesOperations TdeCertificates { get; } + + /// + /// Gets the ITimeZonesOperations. + /// + ITimeZonesOperations TimeZones { get; } + + /// + /// Gets the ITransparentDataEncryptionsOperations. + /// + ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; } + + /// + /// Gets the IVirtualClustersOperations. + /// + IVirtualClustersOperations VirtualClusters { get; } + + /// + /// Gets the IVirtualNetworkRulesOperations. + /// + IVirtualNetworkRulesOperations VirtualNetworkRules { get; } + + /// + /// Gets the IWorkloadClassifiersOperations. + /// + IWorkloadClassifiersOperations WorkloadClassifiers { get; } + + /// + /// Gets the IWorkloadGroupsOperations. + /// + IWorkloadGroupsOperations WorkloadGroups { get; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs new file mode 100644 index 000000000000..98239ccf0fc8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimeZonesOperations operations. + /// + public partial interface ITimeZonesOperations + { + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a managed instance time zone. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string locationName, string timeZoneId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs index 818b21be23d3..e79200fd413f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs @@ -24,7 +24,38 @@ namespace Microsoft.Azure.Management.Sql public partial interface ITransparentDataEncryptionsOperations { /// - /// Creates or updates a database's transparent data encryption + /// Gets a logical database's transparent data encryption. + /// + /// + /// 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 logical database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a logical database's transparent data encryption /// configuration. /// /// @@ -36,12 +67,11 @@ public partial interface ITransparentDataEncryptionsOperations /// The name of the server. /// /// - /// The name of the database for which setting the transparent data - /// encryption applies. + /// The name of the logical database for which the security alert + /// policy is defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// /// /// The headers that will be added to request. @@ -58,9 +88,9 @@ public partial interface ITransparentDataEncryptionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can @@ -71,8 +101,30 @@ public partial interface ITransparentDataEncryptionsOperations /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption - /// applies. + /// The name of the logical database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -89,6 +141,6 @@ public partial interface ITransparentDataEncryptionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs index 23a69eddfd98..65bb4f5d51a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs @@ -23,6 +23,34 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IVirtualClustersOperations { + /// + /// Synchronizes the DNS server settings used by the managed instances + /// inside the given virtual cluster. + /// + /// + /// 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 virtual cluster. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateDnsServersWithHttpMessagesAsync(string resourceGroupName, string virtualClusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of all virtualClusters in the subscription. /// @@ -129,7 +157,7 @@ public partial interface IVirtualClustersOperations /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. @@ -183,7 +211,7 @@ public partial interface IVirtualClustersOperations /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs deleted file mode 100644 index 669d67e32d6b..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs +++ /dev/null @@ -1,305 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ImportExportOperations operations. - /// - internal partial class ImportExportOperations : IServiceOperations, IImportExportOperations - { - /// - /// Initializes a new instance of the ImportExportOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ImportExportOperations(SqlManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SqlManagementClient - /// - public SqlManagementClient Client { get; private set; } - - /// - /// 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. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await 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. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2020-02-02-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs deleted file mode 100644 index 256cedb55dd0..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ImportExportOperations. - /// - public static partial class ImportExportOperationsExtensions - { - /// - /// 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 database import request parameters. - /// - public static ImportExportOperationResult Import(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) - { - return operations.ImportAsync(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 database import request parameters. - /// - /// - /// The cancellation token. - /// - public static async Task ImportAsync(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// 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 database import request parameters. - /// - public static ImportExportOperationResult BeginImport(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) - { - return 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 database import request parameters. - /// - /// - /// The cancellation token. - /// - public static async Task BeginImportAsync(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs index 2596e4085a07..a58b454d5404 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs @@ -102,7 +102,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -354,7 +356,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -364,7 +369,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -375,9 +379,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -485,7 +489,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -621,7 +625,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -633,7 +640,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("locationName", locationName); tracingParameters.Add("failoverGroupName", failoverGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -645,9 +651,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -847,7 +853,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -858,7 +867,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -870,9 +878,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1034,7 +1042,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1045,7 +1056,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } @@ -1057,9 +1067,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1239,7 +1249,10 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1250,7 +1263,6 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("failoverGroupName", failoverGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginForceFailoverAllowDataLoss", tracingParameters); } @@ -1262,9 +1274,9 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _url = _url.Replace("{failoverGroupName}", System.Uri.EscapeDataString(failoverGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1545,7 +1557,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs index c8d461ed5c3a..1b6c09538c06 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs @@ -95,7 +95,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal InstancePoolsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -116,9 +118,9 @@ internal InstancePoolsOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -358,7 +360,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,7 +372,6 @@ internal InstancePoolsOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -377,9 +381,9 @@ internal InstancePoolsOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -487,7 +491,7 @@ internal InstancePoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -536,7 +540,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -544,7 +551,6 @@ internal InstancePoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -553,9 +559,9 @@ internal InstancePoolsOperations(SqlManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -663,7 +669,7 @@ internal InstancePoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -738,7 +744,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -749,7 +758,6 @@ internal InstancePoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -760,9 +768,9 @@ internal InstancePoolsOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -955,7 +963,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -965,7 +976,6 @@ internal InstancePoolsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -976,9 +986,9 @@ internal InstancePoolsOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1139,7 +1149,10 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1150,7 +1163,6 @@ internal InstancePoolsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1161,9 +1173,9 @@ internal InstancePoolsOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1450,7 +1462,7 @@ internal InstancePoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1623,7 +1635,7 @@ internal InstancePoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs index 1dd2de8a0187..02645e770779 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs @@ -95,7 +95,10 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal JobAgentsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -116,9 +118,9 @@ internal JobAgentsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal JobAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -297,7 +299,10 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,7 +313,6 @@ internal JobAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -320,9 +324,9 @@ internal JobAgentsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -596,7 +600,10 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -608,7 +615,6 @@ internal JobAgentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -620,9 +626,9 @@ internal JobAgentsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -822,7 +828,10 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -833,7 +842,6 @@ internal JobAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -845,9 +853,9 @@ internal JobAgentsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1015,7 +1023,10 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1027,7 +1038,6 @@ internal JobAgentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1039,9 +1049,9 @@ internal JobAgentsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1328,7 +1338,7 @@ internal JobAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs index e030fd0a0227..14b28bf395d1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs @@ -102,7 +102,10 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal JobCredentialsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByAgent", tracingParameters); } @@ -125,9 +127,9 @@ internal JobCredentialsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -235,7 +237,7 @@ internal JobCredentialsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -313,7 +315,10 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +330,6 @@ internal JobCredentialsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("credentialName", credentialName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -338,9 +342,9 @@ internal JobCredentialsOperations(SqlManagementClient client) _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -537,7 +541,10 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,7 +557,6 @@ internal JobCredentialsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("credentialName", credentialName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -563,9 +569,9 @@ internal JobCredentialsOperations(SqlManagementClient client) _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -772,7 +778,10 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -784,7 +793,6 @@ internal JobCredentialsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("credentialName", credentialName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -797,9 +805,9 @@ internal JobCredentialsOperations(SqlManagementClient client) _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1062,7 +1070,7 @@ internal JobCredentialsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs index ce9b96d7b30f..a47aec8b39de 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs @@ -109,7 +109,7 @@ internal JobExecutionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByAgentWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByAgentWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -127,7 +127,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -145,7 +148,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("isActive", isActive); tracingParameters.Add("skip", skip); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByAgent", tracingParameters); } @@ -185,9 +187,9 @@ internal JobExecutionsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -295,7 +297,7 @@ internal JobExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -373,7 +375,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -386,7 +391,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobExecutionId", jobExecutionId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } @@ -400,9 +404,9 @@ internal JobExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{jobExecutionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(jobExecutionId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -602,7 +606,7 @@ internal JobExecutionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByJobWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByJobWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -624,7 +628,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -643,7 +650,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("isActive", isActive); tracingParameters.Add("skip", skip); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByJob", tracingParameters); } @@ -684,9 +690,9 @@ internal JobExecutionsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -794,7 +800,7 @@ internal JobExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -875,7 +881,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -888,7 +897,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobExecutionId", jobExecutionId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -902,9 +910,9 @@ internal JobExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{jobExecutionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(jobExecutionId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1122,7 +1130,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1134,7 +1145,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } @@ -1147,9 +1157,9 @@ internal JobExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1338,7 +1348,10 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1351,7 +1364,6 @@ internal JobExecutionsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobExecutionId", jobExecutionId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1365,9 +1377,9 @@ internal JobExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{jobExecutionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(jobExecutionId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1666,7 +1678,7 @@ internal JobExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1839,7 +1851,7 @@ internal JobExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperationsExtensions.cs index fcac4b069c70..432c087fd8ec 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperationsExtensions.cs @@ -62,7 +62,7 @@ public static partial class JobExecutionsOperationsExtensions /// /// The number of elements to return from the collection. /// - public static IPage ListByAgent(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?)) + public static IPage ListByAgent(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?)) { return operations.ListByAgentAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).GetAwaiter().GetResult(); } @@ -111,7 +111,7 @@ public static partial class JobExecutionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByAgentAsync(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByAgentAsync(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByAgentWithHttpMessagesAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, null, cancellationToken).ConfigureAwait(false)) { @@ -274,7 +274,7 @@ public static JobExecution Create(this IJobExecutionsOperations operations, stri /// /// The number of elements to return from the collection. /// - public static IPage ListByJob(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?)) + public static IPage ListByJob(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?)) { return operations.ListByJobAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).GetAwaiter().GetResult(); } @@ -326,7 +326,7 @@ public static JobExecution Create(this IJobExecutionsOperations operations, stri /// /// The cancellation token. /// - public static async Task> ListByJobAsync(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByJobAsync(this IJobExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByJobWithHttpMessagesAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs index 9af657b8e146..460e3c9da87e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs @@ -115,7 +115,7 @@ internal JobStepExecutionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -137,7 +137,10 @@ internal JobStepExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -157,7 +160,6 @@ internal JobStepExecutionsOperations(SqlManagementClient client) tracingParameters.Add("isActive", isActive); tracingParameters.Add("skip", skip); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByJobExecution", tracingParameters); } @@ -199,9 +201,9 @@ internal JobStepExecutionsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -309,7 +311,7 @@ internal JobStepExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -397,7 +399,10 @@ internal JobStepExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -411,7 +416,6 @@ internal JobStepExecutionsOperations(SqlManagementClient client) tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobExecutionId", jobExecutionId); tracingParameters.Add("stepName", stepName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -426,9 +430,9 @@ internal JobStepExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{stepName}", System.Uri.EscapeDataString(stepName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -709,7 +713,7 @@ internal JobStepExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperationsExtensions.cs index 57c38c69f208..e8d9d8a0aea3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperationsExtensions.cs @@ -68,7 +68,7 @@ public static partial class JobStepExecutionsOperationsExtensions /// /// The number of elements to return from the collection. /// - public static IPage ListByJobExecution(this IJobStepExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?)) + public static IPage ListByJobExecution(this IJobStepExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?)) { return operations.ListByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).GetAwaiter().GetResult(); } @@ -123,7 +123,7 @@ public static partial class JobStepExecutionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByJobExecutionAsync(this IJobStepExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByJobExecutionAsync(this IJobStepExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByJobExecutionWithHttpMessagesAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs index 1bc81f5513c0..72ebad1990cd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs @@ -112,7 +112,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,7 +128,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobVersion", jobVersion); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByVersion", tracingParameters); } @@ -139,9 +141,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{jobVersion}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(jobVersion, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -249,7 +251,7 @@ internal JobStepsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -337,7 +339,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -351,7 +356,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobVersion", jobVersion); tracingParameters.Add("stepName", stepName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByVersion", tracingParameters); } @@ -366,9 +370,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{stepName}", System.Uri.EscapeDataString(stepName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -554,7 +558,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -566,7 +573,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByJob", tracingParameters); } @@ -579,9 +585,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -689,7 +695,7 @@ internal JobStepsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -774,7 +780,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -787,7 +796,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("stepName", stepName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -801,9 +809,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{stepName}", System.Uri.EscapeDataString(stepName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1008,7 +1016,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1022,7 +1033,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("jobName", jobName); tracingParameters.Add("stepName", stepName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -1036,9 +1046,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{stepName}", System.Uri.EscapeDataString(stepName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1252,7 +1262,10 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1265,7 +1278,6 @@ internal JobStepsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("stepName", stepName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1279,9 +1291,9 @@ internal JobStepsOperations(SqlManagementClient client) _url = _url.Replace("{stepName}", System.Uri.EscapeDataString(stepName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1544,7 +1556,7 @@ internal JobStepsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1717,7 +1729,7 @@ internal JobStepsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs index d4817fd08a08..6519d5f3dd70 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs @@ -115,7 +115,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByJobExecutionWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -137,7 +137,10 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -157,7 +160,6 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) tracingParameters.Add("isActive", isActive); tracingParameters.Add("skip", skip); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByJobExecution", tracingParameters); } @@ -199,9 +201,9 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -309,7 +311,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -396,7 +398,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByStepWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByStepWithHttpMessagesAsync(string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -422,7 +424,10 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -443,7 +448,6 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) tracingParameters.Add("isActive", isActive); tracingParameters.Add("skip", skip); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByStep", tracingParameters); } @@ -486,9 +490,9 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -596,7 +600,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -687,7 +691,10 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,7 +709,6 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) tracingParameters.Add("jobExecutionId", jobExecutionId); tracingParameters.Add("stepName", stepName); tracingParameters.Add("targetId", targetId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -718,9 +724,9 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) _url = _url.Replace("{targetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(targetId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1001,7 +1007,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1174,7 +1180,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperationsExtensions.cs index 98b6476e6199..a1d2c8bafe72 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperationsExtensions.cs @@ -68,7 +68,7 @@ public static partial class JobTargetExecutionsOperationsExtensions /// /// The number of elements to return from the collection. /// - public static IPage ListByJobExecution(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?)) + public static IPage ListByJobExecution(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?)) { return operations.ListByJobExecutionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).GetAwaiter().GetResult(); } @@ -123,7 +123,7 @@ public static partial class JobTargetExecutionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByJobExecutionAsync(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByJobExecutionAsync(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByJobExecutionWithHttpMessagesAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, null, cancellationToken).ConfigureAwait(false)) { @@ -181,7 +181,7 @@ public static partial class JobTargetExecutionsOperationsExtensions /// /// The number of elements to return from the collection. /// - public static IPage ListByStep(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?)) + public static IPage ListByStep(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?)) { return operations.ListByStepAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).GetAwaiter().GetResult(); } @@ -239,7 +239,7 @@ public static partial class JobTargetExecutionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByStepAsync(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByStepAsync(this IJobTargetExecutionsOperations operations, string resourceGroupName, string serverName, string jobAgentName, string jobName, System.Guid jobExecutionId, string stepName, System.DateTime? createTimeMin = default(System.DateTime?), System.DateTime? createTimeMax = default(System.DateTime?), System.DateTime? endTimeMin = default(System.DateTime?), System.DateTime? endTimeMax = default(System.DateTime?), bool? isActive = default(bool?), long? skip = default(long?), long? top = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByStepWithHttpMessagesAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs index 38240af52680..43857ccd4100 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs @@ -102,7 +102,10 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal JobTargetGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByAgent", tracingParameters); } @@ -125,9 +127,9 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -235,7 +237,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -313,7 +315,10 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +330,6 @@ internal JobTargetGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("targetGroupName", targetGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -338,9 +342,9 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _url = _url.Replace("{targetGroupName}", System.Uri.EscapeDataString(targetGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -537,7 +541,10 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,7 +557,6 @@ internal JobTargetGroupsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("targetGroupName", targetGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -563,9 +569,9 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _url = _url.Replace("{targetGroupName}", System.Uri.EscapeDataString(targetGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -772,7 +778,10 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -784,7 +793,6 @@ internal JobTargetGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("targetGroupName", targetGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -797,9 +805,9 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _url = _url.Replace("{targetGroupName}", System.Uri.EscapeDataString(targetGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1062,7 +1070,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs index 95c25514ce53..c9703e427906 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs @@ -109,7 +109,10 @@ internal JobVersionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,7 +124,6 @@ internal JobVersionsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByJob", tracingParameters); } @@ -134,9 +136,9 @@ internal JobVersionsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -244,7 +246,7 @@ internal JobVersionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -325,7 +327,10 @@ internal JobVersionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -338,7 +343,6 @@ internal JobVersionsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("jobVersion", jobVersion); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -352,9 +356,9 @@ internal JobVersionsOperations(SqlManagementClient client) _url = _url.Replace("{jobVersion}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(jobVersion, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -635,7 +639,7 @@ internal JobVersionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs index c332ef3b62ae..47ec867c9575 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs @@ -102,7 +102,10 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal JobsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByAgent", tracingParameters); } @@ -125,9 +127,9 @@ internal JobsOperations(SqlManagementClient client) _url = _url.Replace("{jobAgentName}", System.Uri.EscapeDataString(jobAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -235,7 +237,7 @@ internal JobsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -313,7 +315,10 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +330,6 @@ internal JobsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -338,9 +342,9 @@ internal JobsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -533,7 +537,10 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,7 +553,6 @@ internal JobsOperations(SqlManagementClient client) tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -559,9 +565,9 @@ internal JobsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -768,7 +774,10 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -780,7 +789,6 @@ internal JobsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("jobAgentName", jobAgentName); tracingParameters.Add("jobName", jobName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -793,9 +801,9 @@ internal JobsOperations(SqlManagementClient client) _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1058,7 +1066,7 @@ internal JobsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperations.cs new file mode 100644 index 000000000000..80db7243fe58 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperations.cs @@ -0,0 +1,1075 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LedgerDigestUploadsOperations operations. + /// + internal partial class LedgerDigestUploadsOperations : IServiceOperations, ILedgerDigestUploadsOperations + { + /// + /// Initializes a new instance of the LedgerDigestUploadsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LedgerDigestUploadsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets the current ledger digest upload configuration for 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string ledgerDigestUploads = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}").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("{ledgerDigestUploads}", System.Uri.EscapeDataString(ledgerDigestUploads)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Enables upload ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the 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 Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploads parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string ledgerDigestUploads = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}").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("{ledgerDigestUploads}", System.Uri.EscapeDataString(ledgerDigestUploads)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all ledger digest upload settings on 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads").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(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Disables uploading ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the 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 Task> DisableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string ledgerDigestUploads = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Disable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable").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("{ledgerDigestUploads}", System.Uri.EscapeDataString(ledgerDigestUploads)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all ledger digest upload settings on a database. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperationsExtensions.cs new file mode 100644 index 000000000000..eb654d117b65 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperationsExtensions.cs @@ -0,0 +1,259 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LedgerDigestUploadsOperations. + /// + public static partial class LedgerDigestUploadsOperationsExtensions + { + /// + /// Gets the current ledger digest upload configuration for 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 LedgerDigestUploads Get(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets the current ledger digest upload configuration for 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 Task GetAsync(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Enables upload ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// + public static LedgerDigestUploads CreateOrUpdate(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName, LedgerDigestUploads parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Enables upload ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName, LedgerDigestUploads parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all ledger digest upload settings on 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 IPage ListByDatabase(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets all ledger digest upload settings on 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 Task> ListByDatabaseAsync(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Disables uploading ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + public static LedgerDigestUploads Disable(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.DisableAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Disables uploading ledger digests to an Azure Storage account or an Azure + /// Confidential Ledger instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The cancellation token. + /// + public static async Task DisableAsync(this ILedgerDigestUploadsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DisableWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all ledger digest upload settings on a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ILedgerDigestUploadsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all ledger digest upload settings on a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this ILedgerDigestUploadsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs index 37c396a655b1..2de89910bd01 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs @@ -170,7 +170,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -182,7 +185,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -195,9 +197,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -410,7 +412,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -423,7 +428,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -443,9 +447,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -553,7 +557,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -616,7 +620,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -627,7 +634,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("locationName", locationName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -645,9 +651,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -755,7 +761,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -825,7 +831,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -837,7 +846,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -856,9 +864,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -966,7 +974,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1121,7 +1129,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1134,7 +1145,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByResourceGroup", tracingParameters); } @@ -1148,9 +1158,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1375,7 +1385,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1389,7 +1402,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupDatabase", tracingParameters); } @@ -1410,9 +1422,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1520,7 +1532,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1591,7 +1603,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1603,7 +1618,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("locationName", locationName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupLocation", tracingParameters); } @@ -1622,9 +1636,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1732,7 +1746,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1810,7 +1824,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1823,7 +1840,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupServer", tracingParameters); } @@ -1843,9 +1859,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1953,7 +1969,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2037,7 +2053,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2050,7 +2069,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCopy", tracingParameters); } @@ -2063,9 +2081,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2263,7 +2281,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2276,7 +2297,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -2289,9 +2309,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2479,7 +2499,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2491,7 +2514,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -2504,9 +2526,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2688,7 +2710,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2702,7 +2727,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCopyByResourceGroup", tracingParameters); } @@ -2716,9 +2740,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2924,7 +2948,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2938,7 +2965,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateByResourceGroup", tracingParameters); } @@ -2952,9 +2978,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3150,7 +3176,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3163,7 +3192,6 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteByResourceGroup", tracingParameters); } @@ -3177,9 +3205,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3442,7 +3470,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3615,7 +3643,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3788,7 +3816,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3961,7 +3989,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -4134,7 +4162,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -4307,7 +4335,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs index 67eb9ce02161..6926c750267c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs @@ -108,7 +108,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -120,7 +123,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -133,9 +135,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -348,7 +350,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +366,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -381,9 +385,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -491,7 +495,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -561,7 +565,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -573,7 +580,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -592,9 +598,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -702,7 +708,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -766,7 +772,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -777,7 +786,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("locationName", locationName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -795,9 +803,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -905,7 +913,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -990,7 +998,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1003,7 +1014,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByResourceGroup", tracingParameters); } @@ -1017,9 +1027,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1244,7 +1254,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1258,7 +1271,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupDatabase", tracingParameters); } @@ -1279,9 +1291,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1389,7 +1401,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1467,7 +1479,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1480,7 +1495,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupInstance", tracingParameters); } @@ -1500,9 +1514,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1610,7 +1624,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1682,7 +1696,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1694,7 +1711,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("locationName", locationName); tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); tracingParameters.Add("databaseState", databaseState); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupLocation", tracingParameters); } @@ -1713,9 +1729,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1823,7 +1839,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1897,7 +1913,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1909,7 +1928,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1922,9 +1940,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2096,7 +2114,10 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2109,7 +2130,6 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("backupName", backupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteByResourceGroup", tracingParameters); } @@ -2123,9 +2143,9 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2388,7 +2408,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2561,7 +2581,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2735,7 +2755,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2908,7 +2928,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3081,7 +3101,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3255,7 +3275,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs index 4d8895d6fa49..f37f3982edaa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs @@ -102,8 +102,11 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -338,7 +340,10 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -349,7 +354,6 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -361,9 +365,9 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -471,7 +475,7 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -549,8 +553,11 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -563,7 +570,6 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -576,9 +582,9 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -865,7 +871,7 @@ internal LongTermRetentionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs similarity index 83% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs index f6ea310015fe..a59adcf5ea81 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// TransparentDataEncryptionActivitiesOperations operations. + /// MaintenanceWindowOptionsOperations operations. /// - internal partial class TransparentDataEncryptionActivitiesOperations : IServiceOperations, ITransparentDataEncryptionActivitiesOperations + internal partial class MaintenanceWindowOptionsOperations : IServiceOperations, IMaintenanceWindowOptionsOperations { /// - /// Initializes a new instance of the TransparentDataEncryptionActivitiesOperations class. + /// Initializes a new instance of the MaintenanceWindowOptionsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class TransparentDataEncryptionActivitiesOperations : IServiceO /// /// Thrown when a required parameter is null /// - internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient client) + internal MaintenanceWindowOptionsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien public SqlManagementClient Client { get; private set; } /// - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,7 +61,10 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the database to get maintenance windows options for. + /// + /// + /// Maintenance window options name. /// /// /// Headers that will be added to request. @@ -84,12 +87,8 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien /// /// A response object containing the response body and response headers. /// - public async Task>> ListByConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -102,8 +101,18 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; + if (maintenanceWindowOptionsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowOptionsName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -111,26 +120,28 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + tracingParameters.Add("maintenanceWindowOptionsName", maintenanceWindowOptionsName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByConfiguration", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindowOptions/current").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("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (maintenanceWindowOptionsName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowOptionsName={0}", System.Uri.EscapeDataString(maintenanceWindowOptionsName))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -225,7 +236,7 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -238,7 +249,7 @@ internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient clien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs similarity index 56% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs index 6211972ac38c..559a2b79077b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs @@ -13,18 +13,16 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for TransparentDataEncryptionActivitiesOperations. + /// Extension methods for MaintenanceWindowOptionsOperations. /// - public static partial class TransparentDataEncryptionActivitiesOperationsExtensions + public static partial class MaintenanceWindowOptionsOperationsExtensions { /// - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// /// /// The operations group for this extension method. @@ -37,15 +35,18 @@ public static partial class TransparentDataEncryptionActivitiesOperationsExtensi /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the database to get maintenance windows options for. /// - public static IEnumerable ListByConfiguration(this ITransparentDataEncryptionActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// Maintenance window options name. + /// + public static MaintenanceWindowOptions Get(this IMaintenanceWindowOptionsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName) { - return operations.ListByConfigurationAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName).GetAwaiter().GetResult(); } /// - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// /// /// The operations group for this extension method. @@ -58,14 +59,17 @@ public static IEnumerable ListByConfiguration /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the database to get maintenance windows options for. + /// + /// + /// Maintenance window options name. /// /// /// The cancellation token. /// - public static async Task> ListByConfigurationAsync(this ITransparentDataEncryptionActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IMaintenanceWindowOptionsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByConfigurationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs similarity index 84% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs index a428ee442362..4f12a2aa21d1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataMaskingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DataMaskingPoliciesOperations operations. + /// MaintenanceWindowsOperations operations. /// - internal partial class DataMaskingPoliciesOperations : IServiceOperations, IDataMaskingPoliciesOperations + internal partial class MaintenanceWindowsOperations : IServiceOperations, IMaintenanceWindowsOperations { /// - /// Initializes a new instance of the DataMaskingPoliciesOperations class. + /// Initializes a new instance of the MaintenanceWindowsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class DataMaskingPoliciesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal DataMaskingPoliciesOperations(SqlManagementClient client) + internal MaintenanceWindowsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Creates or updates a database data masking policy + /// Gets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,10 +61,10 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to get maintenance windows for. /// - /// - /// Parameters for creating or updating a data masking policy. + /// + /// Maintenance window name. /// /// /// Headers that will be added to request. @@ -87,12 +87,8 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -105,16 +101,18 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) + if (maintenanceWindowName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; - string dataMaskingPolicyName = "Default"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -122,27 +120,28 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("dataMaskingPolicyName", dataMaskingPolicyName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("maintenanceWindowName", maintenanceWindowName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current").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("{dataMaskingPolicyName}", System.Uri.EscapeDataString(dataMaskingPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (maintenanceWindowName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowName={0}", System.Uri.EscapeDataString(maintenanceWindowName))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -151,7 +150,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -182,12 +181,6 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -243,7 +236,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -256,7 +249,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -276,7 +269,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) } /// - /// Gets a database data masking policy. + /// Sets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -286,7 +279,12 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. + /// + /// /// /// /// Headers that will be added to request. @@ -297,9 +295,6 @@ internal DataMaskingPoliciesOperations(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 /// @@ -309,12 +304,8 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -327,8 +318,22 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string dataMaskingPolicyName = "Default"; + if (maintenanceWindowName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -336,26 +341,29 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("dataMaskingPolicyName", dataMaskingPolicyName); + tracingParameters.Add("maintenanceWindowName", maintenanceWindowName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current").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("{dataMaskingPolicyName}", System.Uri.EscapeDataString(dataMaskingPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (maintenanceWindowName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowName={0}", System.Uri.EscapeDataString(maintenanceWindowName))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -364,7 +372,7 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -395,6 +403,12 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -450,31 +464,13 @@ internal DataMaskingPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs similarity index 57% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs index 18c50c663a90..f19d63b13c96 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs @@ -17,12 +17,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for DatabaseThreatDetectionPoliciesOperations. + /// Extension methods for MaintenanceWindowsOperations. /// - public static partial class DatabaseThreatDetectionPoliciesOperationsExtensions + public static partial class MaintenanceWindowsOperationsExtensions { /// - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -35,16 +35,18 @@ public static partial class DatabaseThreatDetectionPoliciesOperationsExtensions /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to get maintenance windows for. /// - public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// Maintenance window name. + /// + public static MaintenanceWindows Get(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName).GetAwaiter().GetResult(); } /// - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -57,22 +59,24 @@ public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPolic /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to get maintenance windows for. + /// + /// + /// Maintenance window name. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -85,19 +89,20 @@ public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPolic /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. /// /// - /// The database Threat Detection policy. /// - public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters) + public static void CreateOrUpdate(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -110,21 +115,19 @@ public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseThreatDet /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. /// /// - /// The database Threat Detection policy. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs index e61053122762..48355f287dd3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs @@ -102,8 +102,11 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -367,7 +369,10 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -378,7 +383,6 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -390,9 +394,9 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -500,7 +504,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -578,8 +582,11 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -592,7 +599,6 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -605,9 +611,9 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -799,8 +805,11 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -813,7 +822,6 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -826,9 +834,9 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1115,7 +1123,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs new file mode 100644 index 000000000000..b4ce700308ee --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs @@ -0,0 +1,1152 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseColumnsOperations operations. + /// + internal partial class ManagedDatabaseColumnsOperations : IServiceOperations, IManagedDatabaseColumnsOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseColumnsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseColumnsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List managed database columns + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schema", schema); + tracingParameters.Add("table", table); + tracingParameters.Add("column", column); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (schema != null) + { + if (schema.Count == 0) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in schema) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (table != null) + { + if (table.Count == 0) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in table) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (column != null) + { + if (column.Count == 0) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in column) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (orderBy != null) + { + if (orderBy.Count == 0) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in orderBy) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database columns + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get managed database column + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTableNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs new file mode 100644 index 000000000000..6133264edb2b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseColumnsOperations. + /// + public static partial class ManagedDatabaseColumnsOperationsExtensions + { + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByTable(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByTableAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + public static DatabaseColumn Get(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Get managed database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByTableNext(this IManagedDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByTableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableNextAsync(this IManagedDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs new file mode 100644 index 000000000000..544a52818f4d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs @@ -0,0 +1,680 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseQueriesOperations operations. + /// + internal partial class ManagedDatabaseQueriesOperations : IServiceOperations, IManagedDatabaseQueriesOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseQueriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseQueriesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Get query by query id. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The 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 Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (queryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "queryId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("queryId", queryId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{queryId}", System.Uri.EscapeDataString(queryId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByQueryWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (queryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "queryId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("queryId", queryId); + tracingParameters.Add("startTime", startTime); + tracingParameters.Add("endTime", endTime); + tracingParameters.Add("interval", interval); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByQuery", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}/statistics").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{queryId}", System.Uri.EscapeDataString(queryId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (startTime != null) + { + _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime))); + } + if (endTime != null) + { + _queryParameters.Add(string.Format("endTime={0}", System.Uri.EscapeDataString(endTime))); + } + if (interval != null) + { + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(interval))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByQueryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByQueryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs new file mode 100644 index 000000000000..13a1a4fdad35 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseQueriesOperations. + /// + public static partial class ManagedDatabaseQueriesOperationsExtensions + { + /// + /// Get query by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + public static ManagedInstanceQuery Get(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, queryId).GetAwaiter().GetResult(); + } + + /// + /// Get query by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, queryId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + public static IPage ListByQuery(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string)) + { + return operations.ListByQueryAsync(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval).GetAwaiter().GetResult(); + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByQueryAsync(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByQueryWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByQueryNext(this IManagedDatabaseQueriesOperations operations, string nextPageLink) + { + return operations.ListByQueryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByQueryNextAsync(this IManagedDatabaseQueriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByQueryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs similarity index 75% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs index 27339da3d513..86afc1bcea76 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolActivitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ElasticPoolActivitiesOperations operations. + /// ManagedDatabaseRecommendedSensitivityLabelsOperations operations. /// - internal partial class ElasticPoolActivitiesOperations : IServiceOperations, IElasticPoolActivitiesOperations + internal partial class ManagedDatabaseRecommendedSensitivityLabelsOperations : IServiceOperations, IManagedDatabaseRecommendedSensitivityLabelsOperations { /// - /// Initializes a new instance of the ElasticPoolActivitiesOperations class. + /// Initializes a new instance of the ManagedDatabaseRecommendedSensitivityLabelsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ElasticPoolActivitiesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ElasticPoolActivitiesOperations(SqlManagementClient client) + internal ManagedDatabaseRecommendedSensitivityLabelsOperations(SqlManagementClient client) { if (client == null) { @@ -51,17 +51,20 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Returns elastic pool activities. + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. /// /// /// 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 managed instance. /// - /// - /// The name of the elastic pool for which to get the current activity. + /// + /// The name of the database. + /// + /// /// /// /// Headers that will be added to request. @@ -72,9 +75,6 @@ internal ElasticPoolActivitiesOperations(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 /// @@ -84,25 +84,32 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (elasticPoolName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,24 +117,24 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("elasticPoolName", elasticPoolName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -136,7 +143,7 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -167,6 +174,12 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -222,31 +235,13 @@ internal ElasticPoolActivitiesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs new file mode 100644 index 000000000000..4877ec87a858 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseRecommendedSensitivityLabelsOperations. + /// + public static partial class ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions + { + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + public static void Update(this IManagedDatabaseRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedDatabaseRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs index 2cd4ac21902c..b4f94535cbba 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs @@ -102,8 +102,11 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string restoreDetailsName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("restoreDetailsName", restoreDetailsName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client) _url = _url.Replace("{restoreDetailsName}", System.Uri.EscapeDataString(restoreDetailsName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs new file mode 100644 index 000000000000..89b527e37fcb --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs @@ -0,0 +1,661 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseSchemasOperations operations. + /// + internal partial class ManagedDatabaseSchemasOperations : IServiceOperations, IManagedDatabaseSchemasOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseSchemasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseSchemasOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get managed 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 managed instance. + /// + /// + /// 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 Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed 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 Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs new file mode 100644 index 000000000000..e0170f3e81e5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs @@ -0,0 +1,168 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseSchemasOperations. + /// + public static partial class ManagedDatabaseSchemasOperationsExtensions + { + /// + /// List managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByDatabase(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + public static DatabaseSchema Get(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName).GetAwaiter().GetResult(); + } + + /// + /// Get managed 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 managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseSchemasOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed 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 Task> ListByDatabaseNextAsync(this IManagedDatabaseSchemasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs index 5bbbf04b9705..b1aecebd4e70 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs @@ -103,8 +103,11 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -116,7 +119,6 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -129,9 +131,9 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -322,8 +324,11 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -336,7 +341,6 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -349,9 +353,9 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -555,7 +559,10 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -566,7 +573,6 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -578,9 +584,9 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -688,7 +694,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -861,7 +867,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs similarity index 82% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs index 2873e894aff4..6a5377c0d9fe 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using Newtonsoft.Json; using System.Collections; @@ -23,12 +24,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// RecoverableDatabasesOperations operations. + /// ManagedDatabaseSecurityEventsOperations operations. /// - internal partial class RecoverableDatabasesOperations : IServiceOperations, IRecoverableDatabasesOperations + internal partial class ManagedDatabaseSecurityEventsOperations : IServiceOperations, IManagedDatabaseSecurityEventsOperations { /// - /// Initializes a new instance of the RecoverableDatabasesOperations class. + /// Initializes a new instance of the ManagedDatabaseSecurityEventsOperations class. /// /// /// Reference to the service client. @@ -36,7 +37,7 @@ internal partial class RecoverableDatabasesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal RecoverableDatabasesOperations(SqlManagementClient client) + internal ManagedDatabaseSecurityEventsOperations(SqlManagementClient client) { if (client == null) { @@ -51,18 +52,24 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a recoverable database, which is a resource representing a database's - /// geo backup + /// Gets a list of security events. /// /// /// 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 managed instance. /// /// - /// The name of the database + /// The name of the managed database for which the security events are + /// retrieved. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. /// /// /// Headers that will be added to request. @@ -85,25 +92,28 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); } if (databaseName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -111,24 +121,37 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); + tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("skiptoken", skiptoken); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityEvents").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -223,7 +246,7 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -236,7 +259,7 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -256,14 +279,10 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) } /// - /// Gets a list of recoverable databases + /// Gets a list of security events. /// - /// - /// 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 NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -286,21 +305,12 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,23 +318,14 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -418,7 +419,7 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -431,7 +432,7 @@ internal RecoverableDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs new file mode 100644 index 000000000000..2b3853c378e3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseSecurityEventsOperations. + /// + public static partial class ManagedDatabaseSecurityEventsOperationsExtensions + { + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security events are + /// retrieved. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IManagedDatabaseSecurityEventsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security events are + /// retrieved. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseSecurityEventsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseSecurityEventsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseSecurityEventsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs index 04ed1a2032b9..c4c4e7904a4e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs @@ -128,7 +128,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -143,7 +146,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -159,9 +161,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -368,8 +370,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "current"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -385,7 +390,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -401,9 +405,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -624,8 +628,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "current"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -640,7 +647,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -656,9 +662,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -837,8 +843,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "recommended"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -853,7 +862,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DisableRecommendation", tracingParameters); } @@ -869,9 +877,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1051,8 +1059,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "recommended"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1067,7 +1078,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); } @@ -1083,9 +1093,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1210,6 +1220,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// Headers that will be added to request. /// @@ -1231,7 +1245,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1249,7 +1263,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1261,7 +1278,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("count", count); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); } @@ -1281,9 +1299,17 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (count != null) + { + _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1391,7 +1417,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1410,6 +1436,204 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) return _result; } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The 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 a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets the sensitivity labels of a given database /// @@ -1426,11 +1650,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// Headers that will be added to request. /// @@ -1452,7 +1676,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1470,7 +1694,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1482,9 +1709,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("skipToken", skipToken); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); } @@ -1504,17 +1730,17 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (includeDisabledRecommendations != null) - { - _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); - } if (skipToken != null) { _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); } - if (apiVersion != null) + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1622,7 +1848,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1795,7 +2021,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1968,7 +2194,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs index b619b09ab8b9..c69fc7581d30 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs @@ -378,9 +378,13 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// - public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// + /// + /// + public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) { - return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery).GetAwaiter().GetResult(); + return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); } /// @@ -402,17 +406,70 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + public static void Update(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets the sensitivity labels of a given database /// @@ -432,14 +489,14 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// - public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string)) + public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) { - return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, includeDisabledRecommendations, skipToken).GetAwaiter().GetResult(); + return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); } /// @@ -461,17 +518,17 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The cancellation token. /// - public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, includeDisabledRecommendations, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs new file mode 100644 index 000000000000..509e0b6ce905 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs @@ -0,0 +1,679 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTablesOperations operations. + /// + internal partial class ManagedDatabaseTablesOperations : IServiceOperations, IManagedDatabaseTablesOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseTablesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseTablesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List managed database tables + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchema", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get managed database table + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchemaNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs new file mode 100644 index 000000000000..1a597d451bf0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseTablesOperations. + /// + public static partial class ManagedDatabaseTablesOperationsExtensions + { + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySchema(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaAsync(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + public static DatabaseTable Get(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName).GetAwaiter().GetResult(); + } + + /// + /// Get managed database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySchemaNext(this IManagedDatabaseTablesOperations operations, string nextPageLink) + { + return operations.ListBySchemaNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaNextAsync(this IManagedDatabaseTablesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs new file mode 100644 index 000000000000..f163c9909690 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs @@ -0,0 +1,890 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTransparentDataEncryptionOperations operations. + /// + internal partial class ManagedDatabaseTransparentDataEncryptionOperations : IServiceOperations, IManagedDatabaseTransparentDataEncryptionOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseTransparentDataEncryptionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseTransparentDataEncryptionOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string tdeName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security alert policy is + /// defined. + /// + /// + /// The database transparent data encryption. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string tdeName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs new file mode 100644 index 000000000000..3542c16e7d91 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs @@ -0,0 +1,215 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseTransparentDataEncryptionOperations. + /// + public static partial class ManagedDatabaseTransparentDataEncryptionOperationsExtensions + { + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + public static ManagedTransparentDataEncryption Get(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security alert policy is + /// defined. + /// + /// + /// The database transparent data encryption. + /// + public static ManagedTransparentDataEncryption CreateOrUpdate(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the security alert policy is + /// defined. + /// + /// + /// The database transparent data encryption. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + public static IPage ListByDatabase(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database for which the transparent data encryption + /// is defined. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseTransparentDataEncryptionOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs index b0a6e8a3a629..3c9f6979076f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs @@ -115,8 +115,11 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -130,7 +133,6 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -145,9 +147,9 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -350,8 +352,11 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -366,7 +371,6 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -381,9 +385,9 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -578,8 +582,11 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -593,7 +600,6 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("ruleId", ruleId); tracingParameters.Add("baselineName", baselineName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -608,9 +614,9 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs index 7c3f7bc05a57..313723d44fc8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs @@ -51,7 +51,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie public SqlManagementClient Client { get; private set; } /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -63,6 +63,39 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the scanned database. + /// + /// + /// The vulnerability assessment scan Id. + /// /// /// Headers that will be added to request. /// @@ -84,7 +117,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -98,12 +131,19 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (scanId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,22 +155,23 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("scanId", scanId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Export", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -139,7 +180,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -190,7 +231,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -225,7 +266,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -238,7 +279,25 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -258,7 +317,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie } /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -270,9 +329,6 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// Headers that will be added to request. /// @@ -294,7 +350,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -308,16 +364,15 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (scanId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,24 +384,21 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); - _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -441,7 +493,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -454,7 +506,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -474,7 +526,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie } /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -490,36 +542,6 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// The vulnerability assessment scan Id of the scan to retrieve. /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Convert an existing scan result to a human readable format. If already - /// exists nothing happens - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The name of the scanned database. - /// - /// - /// The vulnerability assessment scan Id. - /// - /// /// Headers that will be added to request. /// /// @@ -540,7 +562,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -562,8 +584,11 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -576,13 +601,12 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Export", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -590,9 +614,9 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -601,7 +625,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -652,7 +676,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -687,7 +711,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -700,25 +724,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -793,8 +799,11 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -807,7 +816,6 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("scanId", scanId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginInitiateScan", tracingParameters); } @@ -821,9 +829,9 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1086,7 +1094,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs index cb7615d9e239..cb2abfd3b76d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -37,13 +37,16 @@ public static partial class ManagedDatabaseVulnerabilityAssessmentScansOperation /// /// The name of the database. /// - public static IPage ListByDatabase(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + operations.InitiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -58,19 +61,20 @@ public static IPage ListByDatabase(this IMana /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateScanAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens /// /// /// The operations group for this extension method. @@ -83,18 +87,19 @@ public static IPage ListByDatabase(this IMana /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// - public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ExportAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens /// /// /// The operations group for this extension method. @@ -107,24 +112,24 @@ public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnera /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExportAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -139,16 +144,13 @@ public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnera /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// - public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static IPage ListByDatabase(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) { - operations.InitiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); } /// - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -163,20 +165,19 @@ public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScan /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The cancellation token. /// - public static async Task InitiateScanAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Convert an existing scan result to a human readable format. If already - /// exists nothing happens + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -189,19 +190,18 @@ public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScan /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// - public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.ExportAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Convert an existing scan result to a human readable format. If already - /// exists nothing happens + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -214,17 +214,17 @@ public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDat /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// /// /// The cancellation token. /// - public static async Task ExportAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs index eb9d3a9926a4..5cc138fb0295 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs @@ -102,8 +102,11 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -316,8 +318,11 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -330,7 +335,6 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -343,9 +347,9 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -545,8 +549,11 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -558,7 +565,6 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -571,9 +577,9 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -734,7 +740,10 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -745,7 +754,6 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -757,9 +765,9 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -867,7 +875,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1040,7 +1048,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs index de5e314814e1..0bc051db4a1c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs @@ -95,7 +95,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -116,9 +118,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -297,7 +299,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,7 +313,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -320,9 +324,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -607,7 +611,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -617,7 +624,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListInaccessibleByInstance", tracingParameters); } @@ -628,9 +634,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -738,7 +744,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -820,7 +826,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -832,7 +841,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -844,9 +852,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1046,7 +1054,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1057,7 +1068,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1069,9 +1079,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1239,7 +1249,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1251,7 +1264,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1263,9 +1275,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1458,7 +1470,10 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1470,7 +1485,6 @@ internal ManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCompleteRestore", tracingParameters); } @@ -1482,9 +1496,9 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1753,7 +1767,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1926,7 +1940,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs index 9fe6d8dd7098..8824ee16c2ea 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs @@ -95,7 +95,10 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -116,9 +118,9 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -290,8 +292,11 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -302,7 +307,6 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("administratorName", administratorName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -314,9 +318,9 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -548,8 +552,11 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -561,7 +568,6 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("administratorName", administratorName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -573,9 +579,9 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -768,8 +774,11 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -780,7 +789,6 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("administratorName", administratorName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -792,9 +800,9 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1057,7 +1065,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs index 563938213255..c79c48d41ddb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs @@ -95,8 +95,11 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("authenticationName", authenticationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -344,7 +346,10 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -365,9 +369,9 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -475,7 +479,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -552,8 +556,11 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -565,7 +572,6 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("authenticationName", authenticationName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -577,9 +583,9 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -772,8 +778,11 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -784,7 +793,6 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("authenticationName", authenticationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -796,9 +804,9 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1061,7 +1069,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs index d09262756457..d9dd4ee5b6bd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs @@ -118,7 +118,10 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -128,7 +131,6 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -139,9 +141,9 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -249,7 +251,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -313,8 +315,11 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +330,6 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -337,9 +341,9 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -534,8 +538,11 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,7 +553,6 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginRevalidate", tracingParameters); } @@ -558,9 +564,9 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -725,8 +731,11 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -738,7 +747,6 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -750,9 +758,9 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1039,7 +1047,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs index b56d54762d3f..2aaac2d28c04 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs @@ -98,7 +98,10 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -109,7 +112,6 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("filter", filter); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -124,9 +126,9 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -234,7 +236,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -305,7 +307,10 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -316,7 +321,6 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -328,9 +332,9 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -577,7 +581,10 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -589,7 +596,6 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("keyName", keyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -601,9 +607,9 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -803,7 +809,10 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -814,7 +823,6 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -826,9 +834,9 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1091,7 +1099,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs index 4d53c404517e..5e7ab300ef96 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs @@ -102,8 +102,11 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,7 +118,6 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -128,9 +130,9 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -338,7 +340,10 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -349,7 +354,6 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -361,9 +365,9 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -471,7 +475,7 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -549,8 +553,11 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -563,7 +570,6 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -576,9 +582,9 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -865,7 +871,7 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs index a142ed7b6254..9f644b35ff4c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs @@ -51,7 +51,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,8 +60,6 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// The name of the managed instance. /// - /// - /// /// /// Headers that will be added to request. /// @@ -71,6 +69,9 @@ internal ManagedInstanceOperations(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 /// @@ -80,7 +81,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -94,7 +95,10 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -104,22 +108,19 @@ internal ManagedInstanceOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}/cancel").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -128,7 +129,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -214,13 +215,31 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -229,7 +248,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) } /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -238,6 +257,8 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// The name of the managed instance. /// + /// + /// /// /// Headers that will be added to request. /// @@ -259,7 +280,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -273,7 +294,10 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -283,20 +307,21 @@ internal ManagedInstanceOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("operationId", operationId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -391,7 +416,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -404,7 +429,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -424,7 +449,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) } /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -444,9 +469,6 @@ internal ManagedInstanceOperations(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 /// @@ -456,7 +478,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -470,7 +492,10 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -481,21 +506,20 @@ internal ManagedInstanceOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}/cancel").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -504,7 +528,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -590,31 +614,13 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -776,7 +782,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs index 7598f83f77db..a7ed94f3e074 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedInstanceOperationsExtensions { /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The operations group for this extension method. @@ -34,15 +34,13 @@ public static partial class ManagedInstanceOperationsExtensions /// /// The name of the managed instance. /// - /// - /// - public static void Cancel(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) + public static IPage ListByManagedInstance(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName) { - operations.CancelAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); } /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The operations group for this extension method. @@ -54,18 +52,19 @@ public static void Cancel(this IManagedInstanceOperations operations, string res /// /// The name of the managed instance. /// - /// - /// /// /// The cancellation token. /// - public static async Task CancelAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByManagedInstanceAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The operations group for this extension method. @@ -77,13 +76,15 @@ public static void Cancel(this IManagedInstanceOperations operations, string res /// /// The name of the managed instance. /// - public static IPage ListByManagedInstance(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName) + /// + /// + public static ManagedInstanceOperation Get(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) { - return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); } /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The operations group for this extension method. @@ -95,19 +96,21 @@ public static IPage ListByManagedInstance(this IManage /// /// The name of the managed instance. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByManagedInstanceAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The operations group for this extension method. @@ -121,13 +124,13 @@ public static IPage ListByManagedInstance(this IManage /// /// /// - public static ManagedInstanceOperation Get(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) + public static void Cancel(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) { - return operations.GetAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); + operations.CancelAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); } /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The operations group for this extension method. @@ -144,12 +147,9 @@ public static ManagedInstanceOperation Get(this IManagedInstanceOperations opera /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CancelAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..b8f549d397f7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1088 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateEndpointConnectionsOperations operations. + /// + internal partial class ManagedInstancePrivateEndpointConnectionsOperations : IServiceOperations, IManagedInstancePrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the ManagedInstancePrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedInstancePrivateEndpointConnectionsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a private endpoint connection. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..d6db30fc0241 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedInstancePrivateEndpointConnectionsOperations. + /// + public static partial class ManagedInstancePrivateEndpointConnectionsOperationsExtensions + { + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private endpoint connection. + /// + public static ManagedInstancePrivateEndpointConnection Get(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedInstancePrivateEndpointConnection CreateOrUpdate(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + public static void Delete(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + public static IPage ListByManagedInstance(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedInstancePrivateEndpointConnection BeginCreateOrUpdate(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + public static void BeginDelete(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedInstanceNext(this IManagedInstancePrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..d9eb95f4e121 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs @@ -0,0 +1,630 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateLinkResourcesOperations operations. + /// + internal partial class ManagedInstancePrivateLinkResourcesOperations : IServiceOperations, IManagedInstancePrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the ManagedInstancePrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedInstancePrivateLinkResourcesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a private link resource for SQL server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private link resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (groupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("groupName", groupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources/{groupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..fe5787a00e1b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedInstancePrivateLinkResourcesOperations. + /// + public static partial class ManagedInstancePrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + public static IPage ListByManagedInstance(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a private link resource for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private link resource. + /// + public static ManagedInstancePrivateLink Get(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, string groupName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, groupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a private link resource for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the private link resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, groupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedInstanceNext(this IManagedInstancePrivateLinkResourcesOperations operations, string nextPageLink) + { + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs index 35957338cd6d..3b690a37f179 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs @@ -129,7 +129,10 @@ internal ManagedInstanceTdeCertificatesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -140,7 +143,6 @@ internal ManagedInstanceTdeCertificatesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } @@ -151,9 +153,9 @@ internal ManagedInstanceTdeCertificatesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs index 4a276e802c64..164c2474761c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs @@ -96,8 +96,11 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -108,7 +111,6 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -120,9 +122,9 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -306,8 +308,11 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +324,6 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -331,9 +335,9 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -527,8 +531,11 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,7 +546,6 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -551,9 +557,9 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -708,7 +714,10 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -718,7 +727,6 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -729,9 +737,9 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -839,7 +847,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1012,7 +1020,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs index 3bc76e76b740..71ebd59cff3a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs @@ -60,6 +60,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -81,7 +84,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -95,7 +98,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +111,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePool", tracingParameters); } @@ -116,9 +122,199 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The child resources to include in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +422,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -252,6 +448,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// 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 child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -273,7 +472,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -283,7 +482,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -292,7 +494,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -302,9 +504,13 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -412,7 +618,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -441,6 +647,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -462,7 +671,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -476,7 +685,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -486,7 +698,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -497,9 +709,13 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -771,7 +987,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -788,7 +1007,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) tracingParameters.Add("interval", interval); tracingParameters.Add("aggregationFunction", aggregationFunction); tracingParameters.Add("observationMetric", observationMetric); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); } @@ -827,9 +1045,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("observationMetric={0}", System.Uri.EscapeDataString(observationMetric))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -937,7 +1155,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -983,182 +1201,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2020-02-02-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Creates or updates a managed instance. /// @@ -1215,7 +1257,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1226,7 +1271,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1237,9 +1281,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1432,7 +1476,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1442,7 +1489,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1453,9 +1499,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1616,7 +1662,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1627,7 +1676,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1638,9 +1686,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1819,7 +1867,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1830,7 +1881,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("replicaType", replicaType); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } @@ -1845,9 +1895,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2110,7 +2160,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2130,7 +2180,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -2156,7 +2206,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2171,7 +2221,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2283,7 +2333,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2303,7 +2353,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -2329,7 +2379,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2344,7 +2394,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2443,7 +2493,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2456,7 +2506,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2476,7 +2526,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The NextLink from the previous successful call to List operation. @@ -2502,7 +2552,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2517,7 +2567,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2616,7 +2666,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2629,7 +2679,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs index c4370ab74b84..76789c27981b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs @@ -34,9 +34,12 @@ public static partial class ManagedInstancesOperationsExtensions /// /// The instance pool name. /// - public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string)) { - return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName).GetAwaiter().GetResult(); + return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expand).GetAwaiter().GetResult(); } /// @@ -52,12 +55,49 @@ public static IPage ListByInstancePool(this IManagedInstancesOp /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// + public static IPage List(this IManagedInstancesOperations operations, string expand = default(string)) + { + return operations.ListAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IManagedInstancesOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -73,9 +113,12 @@ public static IPage ListByInstancePool(this IManagedInstancesOp /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - public static IPage ListByResourceGroup(this IManagedInstancesOperations operations, string resourceGroupName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByResourceGroup(this IManagedInstancesOperations operations, string resourceGroupName, string expand = default(string)) { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName, expand).GetAwaiter().GetResult(); } /// @@ -88,12 +131,15 @@ public static IPage ListByResourceGroup(this IManagedInstancesO /// 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 child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IManagedInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IManagedInstancesOperations operations, string resourceGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -112,9 +158,12 @@ public static IPage ListByResourceGroup(this IManagedInstancesO /// /// The name of the managed instance. /// - public static ManagedInstance Get(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName) + /// + /// The child resources to include in the response. + /// + public static ManagedInstance Get(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, expand).GetAwaiter().GetResult(); } /// @@ -130,12 +179,15 @@ public static ManagedInstance Get(this IManagedInstancesOperations operations, s /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -415,34 +467,6 @@ public static ManagedInstance Update(this IManagedInstancesOperations operations (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IManagedInstancesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IManagedInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates or updates a managed instance. /// @@ -660,7 +684,7 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -668,13 +692,13 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -685,16 +709,16 @@ public static IPage ListByResourceGroupNext(this IManagedInstan /// /// The cancellation token. /// - public static async Task> ListByResourceGroupNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The operations group for this extension method. @@ -702,13 +726,13 @@ public static IPage ListByResourceGroupNext(this IManagedInstan /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByManagedInstanceNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListByResourceGroupNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The operations group for this extension method. @@ -719,16 +743,16 @@ public static IPage ListByManagedInstanceNext(this IManagedInstances /// /// The cancellation token. /// - public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The operations group for this extension method. @@ -736,13 +760,13 @@ public static IPage ListByManagedInstanceNext(this IManagedInstances /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListByManagedInstanceNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The operations group for this extension method. @@ -753,9 +777,9 @@ public static IPage ListNext(this IManagedInstancesOperations o /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs index 08ce3af3a3b7..a4fe49d63feb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs @@ -101,8 +101,11 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,7 +117,6 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -127,9 +129,9 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -257,7 +259,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -269,7 +271,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -285,7 +287,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -297,7 +299,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -363,7 +365,10 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -374,7 +379,6 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByRestorableDroppedDatabase", tracingParameters); } @@ -386,9 +390,9 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _url = _url.Replace("{restorableDroppedDatabaseId}", System.Uri.EscapeDataString(restorableDroppedDatabaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -496,7 +500,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -516,7 +520,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -528,7 +532,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// Headers that will be added to request. @@ -573,8 +577,11 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -587,7 +594,6 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -600,9 +606,9 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -736,7 +742,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -748,7 +754,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// Headers that will be added to request. @@ -793,8 +799,11 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -807,7 +816,6 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); tracingParameters.Add("policyName", policyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -820,9 +828,9 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1109,7 +1117,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs index 0f5a61659b21..ea1bc714908d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs @@ -68,7 +68,7 @@ public static ManagedBackupShortTermRetentionPolicy Get(this IManagedRestorableD } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -83,7 +83,7 @@ public static ManagedBackupShortTermRetentionPolicy Get(this IManagedRestorableD /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -91,7 +91,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -106,7 +106,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -120,7 +120,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -135,7 +135,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -143,7 +143,7 @@ public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorab } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -158,7 +158,7 @@ public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorab /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -218,7 +218,7 @@ public static IPage ListByRestorableDropp } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -233,7 +233,7 @@ public static IPage ListByRestorableDropp /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -241,7 +241,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -256,7 +256,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -270,7 +270,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -285,7 +285,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -293,7 +293,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRes } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -308,7 +308,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRes /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs index 5b323e6642f7..e813ba1782f9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs @@ -95,8 +95,11 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -319,7 +321,10 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,7 +334,6 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -340,9 +344,9 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -450,7 +454,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -525,8 +529,11 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,7 +545,6 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -550,9 +556,9 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -839,7 +845,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs similarity index 65% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs index 5880bd69d615..46fed52dc35b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs @@ -12,11 +12,10 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for TransparentDataEncryptionActivityStatus. + /// Defines values for AdministratorType. /// - public static class TransparentDataEncryptionActivityStatus + public static class AdministratorType { - public const string Encrypting = "Encrypting"; - public const string Decrypting = "Decrypting"; + public const string ActiveDirectory = "ActiveDirectory"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs new file mode 100644 index 000000000000..abb2fb75ae51 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Database, Server or Elastic Pool Advisor. + /// + [Rest.Serialization.JsonTransformation] + public partial class Advisor : ProxyResource + { + /// + /// Initializes a new instance of the Advisor class. + /// + public Advisor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Advisor class. + /// + /// Gets the auto-execute status + /// (whether to let the system execute the recommendations) of this + /// advisor. Possible values are 'Enabled' and 'Disabled'. Possible + /// values include: 'Enabled', 'Disabled', 'Default' + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource kind. + /// Resource location. + /// Gets the status of availability of this + /// advisor to customers. Possible values are 'GA', 'PublicPreview', + /// 'LimitedPublicPreview' and 'PrivatePreview'. Possible values + /// include: 'GA', 'PublicPreview', 'LimitedPublicPreview', + /// 'PrivatePreview' + /// Gets the resource from + /// which current value of auto-execute status is inherited. + /// Auto-execute status can be set on (and inherited from) different + /// levels in the resource hierarchy. Possible values are + /// 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' + /// (when status is not explicitly set on any level). Possible values + /// include: 'Default', 'Subscription', 'Server', 'ElasticPool', + /// 'Database' + /// Gets that status of + /// recommendations for this advisor and reason for not having any + /// recommendations. Possible values include, but are not limited to, + /// 'Ok' (Recommendations available),LowActivity (not enough workload + /// to analyze), 'DbSeemsTuned' (Database is doing well), etc. + /// Gets the time when the current resource + /// was analyzed for recommendations by this advisor. + /// Gets the recommended actions for + /// this advisor. + public Advisor(AutoExecuteStatus autoExecuteStatus, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), AdvisorStatus? advisorStatus = default(AdvisorStatus?), AutoExecuteStatusInheritedFrom? autoExecuteStatusInheritedFrom = default(AutoExecuteStatusInheritedFrom?), string recommendationsStatus = default(string), System.DateTime? lastChecked = default(System.DateTime?), IList recommendedActions = default(IList)) + : base(id, name, type) + { + Kind = kind; + Location = location; + AdvisorStatus = advisorStatus; + AutoExecuteStatus = autoExecuteStatus; + AutoExecuteStatusInheritedFrom = autoExecuteStatusInheritedFrom; + RecommendationsStatus = recommendationsStatus; + LastChecked = lastChecked; + RecommendedActions = recommendedActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the status of availability of this advisor to customers. + /// Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' + /// and 'PrivatePreview'. Possible values include: 'GA', + /// 'PublicPreview', 'LimitedPublicPreview', 'PrivatePreview' + /// + [JsonProperty(PropertyName = "properties.advisorStatus")] + public AdvisorStatus? AdvisorStatus { get; private set; } + + /// + /// Gets the auto-execute status (whether to let the system execute the + /// recommendations) of this advisor. Possible values are 'Enabled' and + /// 'Disabled'. Possible values include: 'Enabled', 'Disabled', + /// 'Default' + /// + [JsonProperty(PropertyName = "properties.autoExecuteStatus")] + public AutoExecuteStatus AutoExecuteStatus { get; set; } + + /// + /// Gets the resource from which current value of auto-execute status + /// is inherited. Auto-execute status can be set on (and inherited + /// from) different levels in the resource hierarchy. Possible values + /// are 'Subscription', 'Server', 'ElasticPool', 'Database' and + /// 'Default' (when status is not explicitly set on any level). + /// Possible values include: 'Default', 'Subscription', 'Server', + /// 'ElasticPool', 'Database' + /// + [JsonProperty(PropertyName = "properties.autoExecuteStatusInheritedFrom")] + public AutoExecuteStatusInheritedFrom? AutoExecuteStatusInheritedFrom { get; private set; } + + /// + /// Gets that status of recommendations for this advisor and reason for + /// not having any recommendations. Possible values include, but are + /// not limited to, 'Ok' (Recommendations available),LowActivity (not + /// enough workload to analyze), 'DbSeemsTuned' (Database is doing + /// well), etc. + /// + [JsonProperty(PropertyName = "properties.recommendationsStatus")] + public string RecommendationsStatus { get; private set; } + + /// + /// Gets the time when the current resource was analyzed for + /// recommendations by this advisor. + /// + [JsonProperty(PropertyName = "properties.lastChecked")] + public System.DateTime? LastChecked { get; private set; } + + /// + /// Gets the recommended actions for this advisor. + /// + [JsonProperty(PropertyName = "properties.recommendedActions")] + public IList RecommendedActions { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecommendedActions != null) + { + foreach (var element in RecommendedActions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs new file mode 100644 index 000000000000..82abfaab68a9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AdvisorStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AdvisorStatus + { + [EnumMember(Value = "GA")] + GA, + [EnumMember(Value = "PublicPreview")] + PublicPreview, + [EnumMember(Value = "LimitedPublicPreview")] + LimitedPublicPreview, + [EnumMember(Value = "PrivatePreview")] + PrivatePreview + } + internal static class AdvisorStatusEnumExtension + { + internal static string ToSerializedValue(this AdvisorStatus? value) + { + return value == null ? null : ((AdvisorStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AdvisorStatus value) + { + switch( value ) + { + case AdvisorStatus.GA: + return "GA"; + case AdvisorStatus.PublicPreview: + return "PublicPreview"; + case AdvisorStatus.LimitedPublicPreview: + return "LimitedPublicPreview"; + case AdvisorStatus.PrivatePreview: + return "PrivatePreview"; + } + return null; + } + + internal static AdvisorStatus? ParseAdvisorStatus(this string value) + { + switch( value ) + { + case "GA": + return AdvisorStatus.GA; + case "PublicPreview": + return AdvisorStatus.PublicPreview; + case "LimitedPublicPreview": + return AdvisorStatus.LimitedPublicPreview; + case "PrivatePreview": + return AdvisorStatus.PrivatePreview; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRuleState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs similarity index 54% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRuleState.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs index d883cf0eaa34..ab1597ba6dbe 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRuleState.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs @@ -16,43 +16,49 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for DataMaskingRuleState. + /// Defines values for AutoExecuteStatus. /// [JsonConverter(typeof(StringEnumConverter))] - public enum DataMaskingRuleState + public enum AutoExecuteStatus { + [EnumMember(Value = "Enabled")] + Enabled, [EnumMember(Value = "Disabled")] Disabled, - [EnumMember(Value = "Enabled")] - Enabled + [EnumMember(Value = "Default")] + Default } - internal static class DataMaskingRuleStateEnumExtension + internal static class AutoExecuteStatusEnumExtension { - internal static string ToSerializedValue(this DataMaskingRuleState? value) + internal static string ToSerializedValue(this AutoExecuteStatus? value) { - return value == null ? null : ((DataMaskingRuleState)value).ToSerializedValue(); + return value == null ? null : ((AutoExecuteStatus)value).ToSerializedValue(); } - internal static string ToSerializedValue(this DataMaskingRuleState value) + internal static string ToSerializedValue(this AutoExecuteStatus value) { switch( value ) { - case DataMaskingRuleState.Disabled: - return "Disabled"; - case DataMaskingRuleState.Enabled: + case AutoExecuteStatus.Enabled: return "Enabled"; + case AutoExecuteStatus.Disabled: + return "Disabled"; + case AutoExecuteStatus.Default: + return "Default"; } return null; } - internal static DataMaskingRuleState? ParseDataMaskingRuleState(this string value) + internal static AutoExecuteStatus? ParseAutoExecuteStatus(this string value) { switch( value ) { - case "Disabled": - return DataMaskingRuleState.Disabled; case "Enabled": - return DataMaskingRuleState.Enabled; + return AutoExecuteStatus.Enabled; + case "Disabled": + return AutoExecuteStatus.Disabled; + case "Default": + return AutoExecuteStatus.Default; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs new file mode 100644 index 000000000000..30ee7be35b62 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AutoExecuteStatusInheritedFrom. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AutoExecuteStatusInheritedFrom + { + [EnumMember(Value = "Default")] + Default, + [EnumMember(Value = "Subscription")] + Subscription, + [EnumMember(Value = "Server")] + Server, + [EnumMember(Value = "ElasticPool")] + ElasticPool, + [EnumMember(Value = "Database")] + Database + } + internal static class AutoExecuteStatusInheritedFromEnumExtension + { + internal static string ToSerializedValue(this AutoExecuteStatusInheritedFrom? value) + { + return value == null ? null : ((AutoExecuteStatusInheritedFrom)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AutoExecuteStatusInheritedFrom value) + { + switch( value ) + { + case AutoExecuteStatusInheritedFrom.Default: + return "Default"; + case AutoExecuteStatusInheritedFrom.Subscription: + return "Subscription"; + case AutoExecuteStatusInheritedFrom.Server: + return "Server"; + case AutoExecuteStatusInheritedFrom.ElasticPool: + return "ElasticPool"; + case AutoExecuteStatusInheritedFrom.Database: + return "Database"; + } + return null; + } + + internal static AutoExecuteStatusInheritedFrom? ParseAutoExecuteStatusInheritedFrom(this string value) + { + switch( value ) + { + case "Default": + return AutoExecuteStatusInheritedFrom.Default; + case "Subscription": + return AutoExecuteStatusInheritedFrom.Subscription; + case "Server": + return AutoExecuteStatusInheritedFrom.Server; + case "ElasticPool": + return AutoExecuteStatusInheritedFrom.ElasticPool; + case "Database": + return AutoExecuteStatusInheritedFrom.Database; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs new file mode 100644 index 000000000000..b454b0c50604 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for ColumnDataType. + /// + public static class ColumnDataType + { + public const string Image = "image"; + public const string Text = "text"; + public const string Uniqueidentifier = "uniqueidentifier"; + public const string Date = "date"; + public const string Time = "time"; + public const string Datetime2 = "datetime2"; + public const string Datetimeoffset = "datetimeoffset"; + public const string Tinyint = "tinyint"; + public const string Smallint = "smallint"; + public const string Int = "int"; + public const string Smalldatetime = "smalldatetime"; + public const string Real = "real"; + public const string Money = "money"; + public const string Datetime = "datetime"; + public const string Float = "float"; + public const string SqlVariant = "sql_variant"; + public const string Ntext = "ntext"; + public const string Bit = "bit"; + public const string Decimal = "decimal"; + public const string Numeric = "numeric"; + public const string Smallmoney = "smallmoney"; + public const string Bigint = "bigint"; + public const string Hierarchyid = "hierarchyid"; + public const string Geometry = "geometry"; + public const string Geography = "geography"; + public const string Varbinary = "varbinary"; + public const string Varchar = "varchar"; + public const string Binary = "binary"; + public const string Char = "char"; + public const string Timestamp = "timestamp"; + public const string Nvarchar = "nvarchar"; + public const string Nchar = "nchar"; + public const string Xml = "xml"; + public const string Sysname = "sysname"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingFunction.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingFunction.cs deleted file mode 100644 index 8f3f7ef3192e..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingFunction.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for DataMaskingFunction. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum DataMaskingFunction - { - [EnumMember(Value = "Default")] - Default, - [EnumMember(Value = "CCN")] - CCN, - [EnumMember(Value = "Email")] - Email, - [EnumMember(Value = "Number")] - Number, - [EnumMember(Value = "SSN")] - SSN, - [EnumMember(Value = "Text")] - Text - } - internal static class DataMaskingFunctionEnumExtension - { - internal static string ToSerializedValue(this DataMaskingFunction? value) - { - return value == null ? null : ((DataMaskingFunction)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this DataMaskingFunction value) - { - switch( value ) - { - case DataMaskingFunction.Default: - return "Default"; - case DataMaskingFunction.CCN: - return "CCN"; - case DataMaskingFunction.Email: - return "Email"; - case DataMaskingFunction.Number: - return "Number"; - case DataMaskingFunction.SSN: - return "SSN"; - case DataMaskingFunction.Text: - return "Text"; - } - return null; - } - - internal static DataMaskingFunction? ParseDataMaskingFunction(this string value) - { - switch( value ) - { - case "Default": - return DataMaskingFunction.Default; - case "CCN": - return DataMaskingFunction.CCN; - case "Email": - return DataMaskingFunction.Email; - case "Number": - return DataMaskingFunction.Number; - case "SSN": - return DataMaskingFunction.SSN; - case "Text": - return DataMaskingFunction.Text; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingPolicy.cs deleted file mode 100644 index 2858a948a68b..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingPolicy.cs +++ /dev/null @@ -1,124 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a database data masking policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class DataMaskingPolicy : ProxyResource - { - /// - /// Initializes a new instance of the DataMaskingPolicy class. - /// - public DataMaskingPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataMaskingPolicy class. - /// - /// The state of the data masking - /// policy. Possible values include: 'Disabled', 'Enabled' - /// Resource ID. - /// Resource name. - /// Resource type. - /// The list of the exempt principals. - /// Specifies the semicolon-separated list of database users for which - /// the data masking policy does not apply. The specified users receive - /// data results without masking for all of the database - /// queries. - /// The list of the application - /// principals. This is a legacy parameter and is no longer - /// used. - /// The masking level. This is a legacy - /// parameter and is no longer used. - /// The location of the data masking - /// policy. - /// The kind of data masking policy. Metadata, used - /// for Azure portal. - public DataMaskingPolicy(DataMaskingState dataMaskingState, string id = default(string), string name = default(string), string type = default(string), string exemptPrincipals = default(string), string applicationPrincipals = default(string), string maskingLevel = default(string), string location = default(string), string kind = default(string)) - : base(id, name, type) - { - DataMaskingState = dataMaskingState; - ExemptPrincipals = exemptPrincipals; - ApplicationPrincipals = applicationPrincipals; - MaskingLevel = maskingLevel; - Location = location; - Kind = kind; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the state of the data masking policy. Possible values - /// include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "properties.dataMaskingState")] - public DataMaskingState DataMaskingState { get; set; } - - /// - /// Gets or sets the list of the exempt principals. Specifies the - /// semicolon-separated list of database users for which the data - /// masking policy does not apply. The specified users receive data - /// results without masking for all of the database queries. - /// - [JsonProperty(PropertyName = "properties.exemptPrincipals")] - public string ExemptPrincipals { get; set; } - - /// - /// Gets the list of the application principals. This is a legacy - /// parameter and is no longer used. - /// - [JsonProperty(PropertyName = "properties.applicationPrincipals")] - public string ApplicationPrincipals { get; private set; } - - /// - /// Gets the masking level. This is a legacy parameter and is no longer - /// used. - /// - [JsonProperty(PropertyName = "properties.maskingLevel")] - public string MaskingLevel { get; private set; } - - /// - /// Gets the location of the data masking policy. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the kind of data masking policy. Metadata, used for Azure - /// portal. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRule.cs deleted file mode 100644 index 0626129ac7c8..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingRule.cs +++ /dev/null @@ -1,229 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a database data masking rule. - /// - [Rest.Serialization.JsonTransformation] - public partial class DataMaskingRule : ProxyResource - { - /// - /// Initializes a new instance of the DataMaskingRule class. - /// - public DataMaskingRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataMaskingRule class. - /// - /// The schema name on which the data masking - /// rule is applied. - /// The table name on which the data masking - /// rule is applied. - /// The column name on which the data masking - /// rule is applied. - /// The masking function that is used for - /// the data masking rule. Possible values include: 'Default', 'CCN', - /// 'Email', 'Number', 'SSN', 'Text' - /// Resource ID. - /// Resource name. - /// Resource type. - /// The rule Id. - /// The alias name. This is a legacy parameter - /// and is no longer used. - /// The rule state. Used to delete a rule. To - /// delete an existing rule, specify the schemaName, tableName, - /// columnName, maskingFunction, and specify ruleState as disabled. - /// However, if the rule doesn't already exist, the rule will be - /// created with ruleState set to enabled, regardless of the provided - /// value of ruleState. Possible values include: 'Disabled', - /// 'Enabled' - /// The numberFrom property of the masking - /// rule. Required if maskingFunction is set to Number, otherwise this - /// parameter will be ignored. - /// The numberTo property of the data masking - /// rule. Required if maskingFunction is set to Number, otherwise this - /// parameter will be ignored. - /// If maskingFunction is set to Text, the - /// number of characters to show unmasked in the beginning of the - /// string. Otherwise, this parameter will be ignored. - /// If maskingFunction is set to Text, the - /// number of characters to show unmasked at the end of the string. - /// Otherwise, this parameter will be ignored. - /// If maskingFunction is set to Text, - /// the character to use for masking the unexposed part of the string. - /// Otherwise, this parameter will be ignored. - /// The location of the data masking - /// rule. - /// The kind of Data Masking Rule. Metadata, used - /// for Azure portal. - public DataMaskingRule(string schemaName, string tableName, string columnName, DataMaskingFunction maskingFunction, string id = default(string), string name = default(string), string type = default(string), string dataMaskingRuleId = default(string), string aliasName = default(string), DataMaskingRuleState? ruleState = default(DataMaskingRuleState?), string numberFrom = default(string), string numberTo = default(string), string prefixSize = default(string), string suffixSize = default(string), string replacementString = default(string), string location = default(string), string kind = default(string)) - : base(id, name, type) - { - DataMaskingRuleId = dataMaskingRuleId; - AliasName = aliasName; - RuleState = ruleState; - SchemaName = schemaName; - TableName = tableName; - ColumnName = columnName; - MaskingFunction = maskingFunction; - NumberFrom = numberFrom; - NumberTo = numberTo; - PrefixSize = prefixSize; - SuffixSize = suffixSize; - ReplacementString = replacementString; - Location = location; - Kind = kind; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the rule Id. - /// - [JsonProperty(PropertyName = "properties.id")] - public string DataMaskingRuleId { get; private set; } - - /// - /// Gets or sets the alias name. This is a legacy parameter and is no - /// longer used. - /// - [JsonProperty(PropertyName = "properties.aliasName")] - public string AliasName { get; set; } - - /// - /// Gets or sets the rule state. Used to delete a rule. To delete an - /// existing rule, specify the schemaName, tableName, columnName, - /// maskingFunction, and specify ruleState as disabled. However, if the - /// rule doesn't already exist, the rule will be created with ruleState - /// set to enabled, regardless of the provided value of ruleState. - /// Possible values include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "properties.ruleState")] - public DataMaskingRuleState? RuleState { get; set; } - - /// - /// Gets or sets the schema name on which the data masking rule is - /// applied. - /// - [JsonProperty(PropertyName = "properties.schemaName")] - public string SchemaName { get; set; } - - /// - /// Gets or sets the table name on which the data masking rule is - /// applied. - /// - [JsonProperty(PropertyName = "properties.tableName")] - public string TableName { get; set; } - - /// - /// Gets or sets the column name on which the data masking rule is - /// applied. - /// - [JsonProperty(PropertyName = "properties.columnName")] - public string ColumnName { get; set; } - - /// - /// Gets or sets the masking function that is used for the data masking - /// rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', - /// 'SSN', 'Text' - /// - [JsonProperty(PropertyName = "properties.maskingFunction")] - public DataMaskingFunction MaskingFunction { get; set; } - - /// - /// Gets or sets the numberFrom property of the masking rule. Required - /// if maskingFunction is set to Number, otherwise this parameter will - /// be ignored. - /// - [JsonProperty(PropertyName = "properties.numberFrom")] - public string NumberFrom { get; set; } - - /// - /// Gets or sets the numberTo property of the data masking rule. - /// Required if maskingFunction is set to Number, otherwise this - /// parameter will be ignored. - /// - [JsonProperty(PropertyName = "properties.numberTo")] - public string NumberTo { get; set; } - - /// - /// Gets or sets if maskingFunction is set to Text, the number of - /// characters to show unmasked in the beginning of the string. - /// Otherwise, this parameter will be ignored. - /// - [JsonProperty(PropertyName = "properties.prefixSize")] - public string PrefixSize { get; set; } - - /// - /// Gets or sets if maskingFunction is set to Text, the number of - /// characters to show unmasked at the end of the string. Otherwise, - /// this parameter will be ignored. - /// - [JsonProperty(PropertyName = "properties.suffixSize")] - public string SuffixSize { get; set; } - - /// - /// Gets or sets if maskingFunction is set to Text, the character to - /// use for masking the unexposed part of the string. Otherwise, this - /// parameter will be ignored. - /// - [JsonProperty(PropertyName = "properties.replacementString")] - public string ReplacementString { get; set; } - - /// - /// Gets the location of the data masking rule. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the kind of Data Masking Rule. Metadata, used for Azure - /// portal. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SchemaName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SchemaName"); - } - if (TableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TableName"); - } - if (ColumnName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ColumnName"); - } - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingState.cs deleted file mode 100644 index a01f91ea5798..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataMaskingState.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for DataMaskingState. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum DataMaskingState - { - [EnumMember(Value = "Disabled")] - Disabled, - [EnumMember(Value = "Enabled")] - Enabled - } - internal static class DataMaskingStateEnumExtension - { - internal static string ToSerializedValue(this DataMaskingState? value) - { - return value == null ? null : ((DataMaskingState)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this DataMaskingState value) - { - switch( value ) - { - case DataMaskingState.Disabled: - return "Disabled"; - case DataMaskingState.Enabled: - return "Enabled"; - } - return null; - } - - internal static DataMaskingState? ParseDataMaskingState(this string value) - { - switch( value ) - { - case "Disabled": - return DataMaskingState.Disabled; - case "Enabled": - return DataMaskingState.Enabled; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs new file mode 100644 index 000000000000..55589b7c55bf --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// User activities of a data warehouse + /// + [Rest.Serialization.JsonTransformation] + public partial class DataWarehouseUserActivities : ProxyResource + { + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// class. + /// + public DataWarehouseUserActivities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Count of running and suspended + /// queries. + public DataWarehouseUserActivities(string id = default(string), string name = default(string), string type = default(string), int? activeQueriesCount = default(int?)) + : base(id, name, type) + { + ActiveQueriesCount = activeQueriesCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets count of running and suspended queries. + /// + [JsonProperty(PropertyName = "properties.activeQueriesCount")] + public int? ActiveQueriesCount { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs index 639db988b972..c49e7503cda1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs @@ -34,31 +34,13 @@ public DatabaseBlobAuditingPolicy() /// /// Initializes a new instance of the DatabaseBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. /// Resource kind. - /// Specifies the blob storage endpoint - /// (e.g. https://MyAccount.blob.core.windows.net). If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is - /// required. - /// Specifies the identifier key - /// of the auditing storage account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// Specifies the number of days to keep in /// the audit logs in the storage account. /// Specifies the Actions-Groups @@ -135,15 +117,13 @@ public DatabaseBlobAuditingPolicy() /// /// For more information, see [Database-Level Audit /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - /// Specifies the blob - /// storage subscription Id. /// Specifies whether /// storageAccountAccessKey value is the storage's secondary /// key. /// Specifies whether audit /// events are sent to Azure Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -165,19 +145,39 @@ public DatabaseBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public DatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + /// required. + /// Specifies the identifier key + /// of the auditing storage account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Specifies the blob + /// storage subscription Id. + public DatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { Kind = kind; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; CustomInit(); } @@ -192,41 +192,6 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "kind")] public string Kind { get; private set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -313,12 +278,6 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -329,8 +288,8 @@ public DatabaseBlobAuditingPolicy() /// /// Gets or sets specifies whether audit events are sent to Azure /// Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -360,6 +319,47 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs new file mode 100644 index 000000000000..9eadc11e6b27 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database column resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseColumn : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseColumn class. + /// + public DatabaseColumn() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseColumn class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The column data type. Possible values + /// include: 'image', 'text', 'uniqueidentifier', 'date', 'time', + /// 'datetime2', 'datetimeoffset', 'tinyint', 'smallint', 'int', + /// 'smalldatetime', 'real', 'money', 'datetime', 'float', + /// 'sql_variant', 'ntext', 'bit', 'decimal', 'numeric', 'smallmoney', + /// 'bigint', 'hierarchyid', 'geometry', 'geography', 'varbinary', + /// 'varchar', 'binary', 'char', 'timestamp', 'nvarchar', 'nchar', + /// 'xml', 'sysname' + /// The table temporal type. Possible values + /// include: 'NonTemporalTable', 'HistoryTable', + /// 'SystemVersionedTemporalTable' + /// Whether or not the column belongs to + /// a memory optimized table. + /// Whether or not the column is + /// computed. + public DatabaseColumn(string id = default(string), string name = default(string), string type = default(string), string columnType = default(string), string temporalType = default(string), bool? memoryOptimized = default(bool?), bool? isComputed = default(bool?)) + : base(id, name, type) + { + ColumnType = columnType; + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + IsComputed = isComputed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the column data type. Possible values include: + /// 'image', 'text', 'uniqueidentifier', 'date', 'time', 'datetime2', + /// 'datetimeoffset', 'tinyint', 'smallint', 'int', 'smalldatetime', + /// 'real', 'money', 'datetime', 'float', 'sql_variant', 'ntext', + /// 'bit', 'decimal', 'numeric', 'smallmoney', 'bigint', 'hierarchyid', + /// 'geometry', 'geography', 'varbinary', 'varchar', 'binary', 'char', + /// 'timestamp', 'nvarchar', 'nchar', 'xml', 'sysname' + /// + [JsonProperty(PropertyName = "properties.columnType")] + public string ColumnType { get; set; } + + /// + /// Gets or sets the table temporal type. Possible values include: + /// 'NonTemporalTable', 'HistoryTable', 'SystemVersionedTemporalTable' + /// + [JsonProperty(PropertyName = "properties.temporalType")] + public string TemporalType { get; set; } + + /// + /// Gets or sets whether or not the column belongs to a memory + /// optimized table. + /// + [JsonProperty(PropertyName = "properties.memoryOptimized")] + public bool? MemoryOptimized { get; set; } + + /// + /// Gets or sets whether or not the column is computed. + /// + [JsonProperty(PropertyName = "properties.isComputed")] + public bool? IsComputed { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs new file mode 100644 index 000000000000..8d24b91ea7d0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An export managed database operation result resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseExtensions : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseExtensions class. + /// + public DatabaseExtensions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseExtensions class. + /// + /// Storage key type. Possible values + /// include: 'SharedAccessKey', 'StorageAccessKey' + /// Storage key. + /// Storage Uri. + /// Resource ID. + /// Resource name. + /// Resource type. + public DatabaseExtensions(string storageKeyType, string storageKey, string storageUri, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + StorageKeyType = storageKeyType; + StorageKey = storageKey; + StorageUri = storageUri; + CustomInit(); + } + /// + /// Static constructor for DatabaseExtensions class. + /// + static DatabaseExtensions() + { + OperationMode = "PolybaseImport"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage key type. Possible values include: + /// 'SharedAccessKey', 'StorageAccessKey' + /// + [JsonProperty(PropertyName = "properties.storageKeyType")] + public string StorageKeyType { get; set; } + + /// + /// Gets or sets storage key. + /// + [JsonProperty(PropertyName = "properties.storageKey")] + public string StorageKey { get; set; } + + /// + /// Gets or sets storage Uri. + /// + [JsonProperty(PropertyName = "properties.storageUri")] + public string StorageUri { get; set; } + + /// + /// Operation Mode. + /// + [JsonProperty(PropertyName = "properties.operationMode")] + public static string OperationMode { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageKeyType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageKeyType"); + } + if (StorageKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageKey"); + } + if (StorageUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageUri"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs new file mode 100644 index 000000000000..de8057297b03 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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(); + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs index c95ba9e6d8b9..078d50f200c6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs @@ -13,10 +13,12 @@ namespace Microsoft.Azure.Management.Sql.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Contains information about a database Threat Detection policy. + /// A database security alert policy. /// [Rest.Serialization.JsonTransformation] public partial class DatabaseSecurityAlertPolicy : ProxyResource @@ -34,41 +36,36 @@ public DatabaseSecurityAlertPolicy() /// Initializes a new instance of the DatabaseSecurityAlertPolicy /// class. /// - /// Specifies the state of the policy. If state is - /// Enabled, storageEndpoint and storageAccountAccessKey are required. - /// Possible values include: 'New', 'Enabled', 'Disabled' + /// Specifies the state of the policy, whether it + /// is enabled or disabled or a policy has not been applied yet on the + /// specific database. Possible values include: 'Enabled', + /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource - /// lives - /// Resource kind. - /// Specifies the semicolon-separated list - /// of alerts that are disabled, or empty string to disable no alerts. - /// Possible values: Sql_Injection; Sql_Injection_Vulnerability; - /// Access_Anomaly; Data_Exfiltration; Unsafe_Action. - /// Specifies the semicolon-separated list - /// of e-mail addresses to which the alert is sent. + /// SystemData of + /// SecurityAlertPolicyResource. + /// Specifies an array of alerts that are + /// disabled. Allowed values are: Sql_Injection, + /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, + /// Unsafe_Action, Brute_Force + /// Specifies an array of e-mail addresses + /// to which the alert is sent. /// Specifies that the alert is sent - /// to the account administrators. Possible values include: 'Enabled', - /// 'Disabled' + /// to the account administrators. /// Specifies the blob storage endpoint /// (e.g. https://MyAccount.blob.core.windows.net). This blob storage - /// will hold all Threat Detection audit logs. If state is Enabled, - /// storageEndpoint is required. + /// will hold all Threat Detection audit logs. /// Specifies the identifier key - /// of the Threat Detection audit storage account. If state is Enabled, - /// storageAccountAccessKey is required. + /// of the Threat Detection audit storage account. /// Specifies the number of days to keep in /// the Threat Detection audit logs. - /// Specifies whether to use the default - /// server policy. Possible values include: 'Enabled', - /// 'Disabled' - public DatabaseSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), string location = default(string), string kind = default(string), string disabledAlerts = default(string), string emailAddresses = default(string), SecurityAlertPolicyEmailAccountAdmins? emailAccountAdmins = default(SecurityAlertPolicyEmailAccountAdmins?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), SecurityAlertPolicyUseServerDefault? useServerDefault = default(SecurityAlertPolicyUseServerDefault?)) + /// Specifies the UTC creation time of the + /// policy. + public DatabaseSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { - Location = location; - Kind = kind; + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -76,7 +73,7 @@ public DatabaseSecurityAlertPolicy() StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; - UseServerDefault = useServerDefault; + CreationTime = creationTime; CustomInit(); } @@ -86,61 +83,52 @@ public DatabaseSecurityAlertPolicy() partial void CustomInit(); /// - /// Gets or sets the geo-location where the resource lives - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets resource kind. + /// Gets systemData of SecurityAlertPolicyResource. /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint and storageAccountAccessKey are required. - /// Possible values include: 'New', 'Enabled', 'Disabled' + /// Gets or sets specifies the state of the policy, whether it is + /// enabled or disabled or a policy has not been applied yet on the + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// - /// Gets or sets specifies the semicolon-separated list of alerts that - /// are disabled, or empty string to disable no alerts. Possible - /// values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; - /// Data_Exfiltration; Unsafe_Action. + /// Gets or sets specifies an array of alerts that are disabled. + /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] - public string DisabledAlerts { get; set; } + public IList DisabledAlerts { get; set; } /// - /// Gets or sets specifies the semicolon-separated list of e-mail - /// addresses to which the alert is sent. + /// Gets or sets specifies an array of e-mail addresses to which the + /// alert is sent. /// [JsonProperty(PropertyName = "properties.emailAddresses")] - public string EmailAddresses { get; set; } + public IList EmailAddresses { get; set; } /// /// Gets or sets specifies that the alert is sent to the account - /// administrators. Possible values include: 'Enabled', 'Disabled' + /// administrators. /// [JsonProperty(PropertyName = "properties.emailAccountAdmins")] - public SecurityAlertPolicyEmailAccountAdmins? EmailAccountAdmins { get; set; } + public bool? EmailAccountAdmins { get; set; } /// /// Gets or sets specifies the blob storage endpoint (e.g. /// https://MyAccount.blob.core.windows.net). This blob storage will - /// hold all Threat Detection audit logs. If state is Enabled, - /// storageEndpoint is required. + /// hold all Threat Detection audit logs. /// [JsonProperty(PropertyName = "properties.storageEndpoint")] public string StorageEndpoint { get; set; } /// /// Gets or sets specifies the identifier key of the Threat Detection - /// audit storage account. If state is Enabled, storageAccountAccessKey - /// is required. + /// audit storage account. /// [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] public string StorageAccountAccessKey { get; set; } @@ -153,11 +141,10 @@ public DatabaseSecurityAlertPolicy() public int? RetentionDays { get; set; } /// - /// Gets or sets specifies whether to use the default server policy. - /// Possible values include: 'Enabled', 'Disabled' + /// Gets specifies the UTC creation time of the policy. /// - [JsonProperty(PropertyName = "properties.useServerDefault")] - public SecurityAlertPolicyUseServerDefault? UseServerDefault { get; set; } + [JsonProperty(PropertyName = "properties.creationTime")] + public System.DateTime? CreationTime { get; private set; } /// /// Validate the object. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs new file mode 100644 index 000000000000..c8476f2a8a48 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database table resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseTable : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseTable class. + /// + public DatabaseTable() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseTable class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The table temporal type. Possible values + /// include: 'NonTemporalTable', 'HistoryTable', + /// 'SystemVersionedTemporalTable' + /// Whether or not the table is memory + /// optimized. + public DatabaseTable(string id = default(string), string name = default(string), string type = default(string), string temporalType = default(string), bool? memoryOptimized = default(bool?)) + : base(id, name, type) + { + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the table temporal type. Possible values include: + /// 'NonTemporalTable', 'HistoryTable', 'SystemVersionedTemporalTable' + /// + [JsonProperty(PropertyName = "properties.temporalType")] + public string TemporalType { get; set; } + + /// + /// Gets or sets whether or not the table is memory optimized. + /// + [JsonProperty(PropertyName = "properties.memoryOptimized")] + public bool? MemoryOptimized { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs index 763dcd923f4c..bd2aa3fd67d2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs @@ -10,13 +10,16 @@ namespace Microsoft.Azure.Management.Sql.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// - /// The database usages. + /// Usage metric of a database. /// - public partial class DatabaseUsage + [Rest.Serialization.JsonTransformation] + public partial class DatabaseUsage : ProxyResource { /// /// Initializes a new instance of the DatabaseUsage class. @@ -29,24 +32,20 @@ public DatabaseUsage() /// /// Initializes a new instance of the DatabaseUsage class. /// - /// The name of the usage metric. - /// The name of the resource. - /// The usage metric display name. - /// The current value of the usage - /// metric. - /// The current limit of the usage metric. - /// The units of the usage metric. - /// The next reset time for the usage - /// metric (ISO8601 format). - public DatabaseUsage(string name = default(string), string resourceName = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string), System.DateTime? nextResetTime = default(System.DateTime?)) + /// Resource ID. + /// Resource name. + /// Resource type. + /// User-readable name of the metric. + /// Current value of the metric. + /// Boundary value of the metric. + /// Unit of the metric. + public DatabaseUsage(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string)) + : base(id, name, type) { - Name = name; - ResourceName = resourceName; DisplayName = displayName; CurrentValue = currentValue; Limit = limit; Unit = unit; - NextResetTime = nextResetTime; CustomInit(); } @@ -56,46 +55,28 @@ public DatabaseUsage() partial void CustomInit(); /// - /// Gets the name of the usage metric. + /// Gets user-readable name of the metric. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the name of the resource. - /// - [JsonProperty(PropertyName = "resourceName")] - public string ResourceName { get; private set; } - - /// - /// Gets the usage metric display name. - /// - [JsonProperty(PropertyName = "displayName")] + [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; private set; } /// - /// Gets the current value of the usage metric. + /// Gets current value of the metric. /// - [JsonProperty(PropertyName = "currentValue")] + [JsonProperty(PropertyName = "properties.currentValue")] public double? CurrentValue { get; private set; } /// - /// Gets the current limit of the usage metric. + /// Gets boundary value of the metric. /// - [JsonProperty(PropertyName = "limit")] + [JsonProperty(PropertyName = "properties.limit")] public double? Limit { get; private set; } /// - /// Gets the units of the usage metric. + /// Gets unit of the metric. /// - [JsonProperty(PropertyName = "unit")] + [JsonProperty(PropertyName = "properties.unit")] public string Unit { get; private set; } - /// - /// Gets the next reset time for the usage metric (ISO8601 format). - /// - [JsonProperty(PropertyName = "nextResetTime")] - public System.DateTime? NextResetTime { get; private set; } - } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs index 4ad6c58749bf..0fcc79220867 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs @@ -42,8 +42,8 @@ public DatabaseVulnerabilityAssessment() /// https://myStorage.blob.core.windows.net/VaScans/). It is required /// if server level vulnerability assessment policy doesn't set /// A shared access signature (SAS - /// Key) that has read and write access to the blob container specified - /// in 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// Key) that has write access to the blob container specified in + /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' /// isn't specified, StorageContainerSasKey is required. /// Specifies the identifier key /// of the storage account for vulnerability assessment scan results. @@ -75,10 +75,10 @@ public DatabaseVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets a shared access signature (SAS Key) that has read and - /// write access to the blob container specified in - /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' - /// isn't specified, StorageContainerSasKey is required. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrimaryAggregationType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs similarity index 52% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrimaryAggregationType.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs index d863b177f680..3cfda63022f9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrimaryAggregationType.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs @@ -12,15 +12,16 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for PrimaryAggregationType. + /// Defines values for DayOfWeek. /// - public static class PrimaryAggregationType + public static class DayOfWeek { - public const string None = "None"; - public const string Average = "Average"; - public const string Count = "Count"; - public const string Minimum = "Minimum"; - public const string Maximum = "Maximum"; - public const string Total = "Total"; + public const string Sunday = "Sunday"; + public const string Monday = "Monday"; + public const string Tuesday = "Tuesday"; + public const string Wednesday = "Wednesday"; + public const string Thursday = "Thursday"; + public const string Friday = "Friday"; + public const string Saturday = "Saturday"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs new file mode 100644 index 000000000000..0f11773e6721 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A deleted server. + /// + [Rest.Serialization.JsonTransformation] + public partial class DeletedServer : ProxyResource + { + /// + /// Initializes a new instance of the DeletedServer class. + /// + public DeletedServer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedServer class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The version of the deleted server. + /// The deletion time of the deleted + /// server. + /// The original ID of the server before + /// deletion. + /// The fully qualified domain + /// name of the server. + public DeletedServer(string id = default(string), string name = default(string), string type = default(string), string version = default(string), System.DateTime? deletionTime = default(System.DateTime?), string originalId = default(string), string fullyQualifiedDomainName = default(string)) + : base(id, name, type) + { + Version = version; + DeletionTime = deletionTime; + OriginalId = originalId; + FullyQualifiedDomainName = fullyQualifiedDomainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the version of the deleted server. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; private set; } + + /// + /// Gets the deletion time of the deleted server. + /// + [JsonProperty(PropertyName = "properties.deletionTime")] + public System.DateTime? DeletionTime { get; private set; } + + /// + /// Gets the original ID of the server before deletion. + /// + [JsonProperty(PropertyName = "properties.originalId")] + public string OriginalId { get; private set; } + + /// + /// Gets the fully qualified domain name of the server. + /// + [JsonProperty(PropertyName = "properties.fullyQualifiedDomainName")] + public string FullyQualifiedDomainName { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolActivity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolActivity.cs deleted file mode 100644 index d2ab5c5d8f31..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolActivity.cs +++ /dev/null @@ -1,233 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the activity on an elastic pool. - /// - [Rest.Serialization.JsonTransformation] - public partial class ElasticPoolActivity : ProxyResource - { - /// - /// Initializes a new instance of the ElasticPoolActivity class. - /// - public ElasticPoolActivity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ElasticPoolActivity class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The geo-location where the resource - /// lives - /// The time the operation finished (ISO8601 - /// format). - /// The error code if available. - /// The error message if available. - /// The error severity if - /// available. - /// The operation name. - /// The unique operation ID. - /// The percentage complete if - /// available. - /// The requested max DTU per - /// database if available. - /// The requested min DTU per - /// database if available. - /// The requested DTU for the pool if - /// available. - /// The requested name for the - /// elastic pool if available. - /// The requested storage limit - /// for the pool in GB if available. - /// The name of the elastic pool. - /// The name of the server the elastic pool is - /// in. - /// The time the operation started (ISO8601 - /// format). - /// The current state of the operation. - /// The requested storage limit - /// in MB. - /// The requested per - /// database DTU guarantee. - /// The requested per database - /// DTU cap. - /// The requested DTU - /// guarantee. - public ElasticPoolActivity(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.DateTime? endTime = default(System.DateTime?), int? errorCode = default(int?), string errorMessage = default(string), int? errorSeverity = default(int?), string operation = default(string), System.Guid operationId = default(System.Guid), int? percentComplete = default(int?), int? requestedDatabaseDtuMax = default(int?), int? requestedDatabaseDtuMin = default(int?), int? requestedDtu = default(int?), string requestedElasticPoolName = default(string), long? requestedStorageLimitInGB = default(long?), string elasticPoolName = default(string), string serverName = default(string), System.DateTime? startTime = default(System.DateTime?), string state = default(string), int? requestedStorageLimitInMB = default(int?), int? requestedDatabaseDtuGuarantee = default(int?), int? requestedDatabaseDtuCap = default(int?), int? requestedDtuGuarantee = default(int?)) - : base(id, name, type) - { - Location = location; - EndTime = endTime; - ErrorCode = errorCode; - ErrorMessage = errorMessage; - ErrorSeverity = errorSeverity; - Operation = operation; - OperationId = operationId; - PercentComplete = percentComplete; - RequestedDatabaseDtuMax = requestedDatabaseDtuMax; - RequestedDatabaseDtuMin = requestedDatabaseDtuMin; - RequestedDtu = requestedDtu; - RequestedElasticPoolName = requestedElasticPoolName; - RequestedStorageLimitInGB = requestedStorageLimitInGB; - ElasticPoolName = elasticPoolName; - ServerName = serverName; - StartTime = startTime; - State = state; - RequestedStorageLimitInMB = requestedStorageLimitInMB; - RequestedDatabaseDtuGuarantee = requestedDatabaseDtuGuarantee; - RequestedDatabaseDtuCap = requestedDatabaseDtuCap; - RequestedDtuGuarantee = requestedDtuGuarantee; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the geo-location where the resource lives - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets the time the operation finished (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.endTime")] - public System.DateTime? EndTime { get; private set; } - - /// - /// Gets the error code if available. - /// - [JsonProperty(PropertyName = "properties.errorCode")] - public int? ErrorCode { get; private set; } - - /// - /// Gets the error message if available. - /// - [JsonProperty(PropertyName = "properties.errorMessage")] - public string ErrorMessage { get; private set; } - - /// - /// Gets the error severity if available. - /// - [JsonProperty(PropertyName = "properties.errorSeverity")] - public int? ErrorSeverity { get; private set; } - - /// - /// Gets the operation name. - /// - [JsonProperty(PropertyName = "properties.operation")] - public string Operation { get; private set; } - - /// - /// Gets the unique operation ID. - /// - [JsonProperty(PropertyName = "properties.operationId")] - public System.Guid OperationId { get; private set; } - - /// - /// Gets the percentage complete if available. - /// - [JsonProperty(PropertyName = "properties.percentComplete")] - public int? PercentComplete { get; private set; } - - /// - /// Gets the requested max DTU per database if available. - /// - [JsonProperty(PropertyName = "properties.requestedDatabaseDtuMax")] - public int? RequestedDatabaseDtuMax { get; private set; } - - /// - /// Gets the requested min DTU per database if available. - /// - [JsonProperty(PropertyName = "properties.requestedDatabaseDtuMin")] - public int? RequestedDatabaseDtuMin { get; private set; } - - /// - /// Gets the requested DTU for the pool if available. - /// - [JsonProperty(PropertyName = "properties.requestedDtu")] - public int? RequestedDtu { get; private set; } - - /// - /// Gets the requested name for the elastic pool if available. - /// - [JsonProperty(PropertyName = "properties.requestedElasticPoolName")] - public string RequestedElasticPoolName { get; private set; } - - /// - /// Gets the requested storage limit for the pool in GB if available. - /// - [JsonProperty(PropertyName = "properties.requestedStorageLimitInGB")] - public long? RequestedStorageLimitInGB { get; private set; } - - /// - /// Gets the name of the elastic pool. - /// - [JsonProperty(PropertyName = "properties.elasticPoolName")] - public string ElasticPoolName { get; private set; } - - /// - /// Gets the name of the server the elastic pool is in. - /// - [JsonProperty(PropertyName = "properties.serverName")] - public string ServerName { get; private set; } - - /// - /// Gets the time the operation started (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.startTime")] - public System.DateTime? StartTime { get; private set; } - - /// - /// Gets the current state of the operation. - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; private set; } - - /// - /// Gets the requested storage limit in MB. - /// - [JsonProperty(PropertyName = "properties.requestedStorageLimitInMB")] - public int? RequestedStorageLimitInMB { get; private set; } - - /// - /// Gets the requested per database DTU guarantee. - /// - [JsonProperty(PropertyName = "properties.requestedDatabaseDtuGuarantee")] - public int? RequestedDatabaseDtuGuarantee { get; private set; } - - /// - /// Gets the requested per database DTU cap. - /// - [JsonProperty(PropertyName = "properties.requestedDatabaseDtuCap")] - public int? RequestedDatabaseDtuCap { get; private set; } - - /// - /// Gets the requested DTU guarantee. - /// - [JsonProperty(PropertyName = "properties.requestedDtuGuarantee")] - public int? RequestedDtuGuarantee { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolDatabaseActivity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolDatabaseActivity.cs deleted file mode 100644 index 2ad2b0f4367c..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolDatabaseActivity.cs +++ /dev/null @@ -1,192 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the activity on an elastic pool. - /// - [Rest.Serialization.JsonTransformation] - public partial class ElasticPoolDatabaseActivity : ProxyResource - { - /// - /// Initializes a new instance of the ElasticPoolDatabaseActivity - /// class. - /// - public ElasticPoolDatabaseActivity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ElasticPoolDatabaseActivity - /// class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The geo-location where the resource - /// lives - /// The database name. - /// The time the operation finished (ISO8601 - /// format). - /// The error code if available. - /// The error message if available. - /// The error severity if - /// available. - /// The operation name. - /// The unique operation ID. - /// The percentage complete if - /// available. - /// The name for the elastic - /// pool the database is moving into if available. - /// The name of the current - /// elastic pool the database is in if available. - /// The name of the current - /// service objective if available. - /// The name of the requested - /// service objective if available. - /// The name of the server the elastic pool is - /// in. - /// The time the operation started (ISO8601 - /// format). - /// The current state of the operation. - public ElasticPoolDatabaseActivity(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string databaseName = default(string), System.DateTime? endTime = default(System.DateTime?), int? errorCode = default(int?), string errorMessage = default(string), int? errorSeverity = default(int?), string operation = default(string), System.Guid operationId = default(System.Guid), int? percentComplete = default(int?), string requestedElasticPoolName = default(string), string currentElasticPoolName = default(string), string currentServiceObjective = default(string), string requestedServiceObjective = default(string), string serverName = default(string), System.DateTime? startTime = default(System.DateTime?), string state = default(string)) - : base(id, name, type) - { - Location = location; - DatabaseName = databaseName; - EndTime = endTime; - ErrorCode = errorCode; - ErrorMessage = errorMessage; - ErrorSeverity = errorSeverity; - Operation = operation; - OperationId = operationId; - PercentComplete = percentComplete; - RequestedElasticPoolName = requestedElasticPoolName; - CurrentElasticPoolName = currentElasticPoolName; - CurrentServiceObjective = currentServiceObjective; - RequestedServiceObjective = requestedServiceObjective; - ServerName = serverName; - StartTime = startTime; - State = state; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the geo-location where the resource lives - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets the database name. - /// - [JsonProperty(PropertyName = "properties.databaseName")] - public string DatabaseName { get; private set; } - - /// - /// Gets the time the operation finished (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.endTime")] - public System.DateTime? EndTime { get; private set; } - - /// - /// Gets the error code if available. - /// - [JsonProperty(PropertyName = "properties.errorCode")] - public int? ErrorCode { get; private set; } - - /// - /// Gets the error message if available. - /// - [JsonProperty(PropertyName = "properties.errorMessage")] - public string ErrorMessage { get; private set; } - - /// - /// Gets the error severity if available. - /// - [JsonProperty(PropertyName = "properties.errorSeverity")] - public int? ErrorSeverity { get; private set; } - - /// - /// Gets the operation name. - /// - [JsonProperty(PropertyName = "properties.operation")] - public string Operation { get; private set; } - - /// - /// Gets the unique operation ID. - /// - [JsonProperty(PropertyName = "properties.operationId")] - public System.Guid OperationId { get; private set; } - - /// - /// Gets the percentage complete if available. - /// - [JsonProperty(PropertyName = "properties.percentComplete")] - public int? PercentComplete { get; private set; } - - /// - /// Gets the name for the elastic pool the database is moving into if - /// available. - /// - [JsonProperty(PropertyName = "properties.requestedElasticPoolName")] - public string RequestedElasticPoolName { get; private set; } - - /// - /// Gets the name of the current elastic pool the database is in if - /// available. - /// - [JsonProperty(PropertyName = "properties.currentElasticPoolName")] - public string CurrentElasticPoolName { get; private set; } - - /// - /// Gets the name of the current service objective if available. - /// - [JsonProperty(PropertyName = "properties.currentServiceObjective")] - public string CurrentServiceObjective { get; private set; } - - /// - /// Gets the name of the requested service objective if available. - /// - [JsonProperty(PropertyName = "properties.requestedServiceObjective")] - public string RequestedServiceObjective { get; private set; } - - /// - /// Gets the name of the server the elastic pool is in. - /// - [JsonProperty(PropertyName = "properties.serverName")] - public string ServerName { get; private set; } - - /// - /// Gets the time the operation started (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.startTime")] - public System.DateTime? StartTime { get; private set; } - - /// - /// Gets the current state of the operation. - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs index ea9fe3a5d1a5..60bf35bb1bc9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs @@ -46,7 +46,9 @@ public EncryptionProtector() /// The name of the server key. /// The URI of the server key. /// Thumbprint of the server key. - public EncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public EncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -56,6 +58,7 @@ public EncryptionProtector() ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -109,6 +112,12 @@ public EncryptionProtector() [JsonProperty(PropertyName = "properties.thumbprint")] public string Thumbprint { get; private set; } + /// + /// Gets or sets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs index fb45c749c8e3..dd8150e3ac2d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs @@ -36,7 +36,7 @@ public ExtendedDatabaseBlobAuditingPolicy() /// Initializes a new instance of the /// ExtendedDatabaseBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. @@ -44,24 +44,6 @@ public ExtendedDatabaseBlobAuditingPolicy() /// Resource type. /// Specifies condition of where /// clause when creating an audit. - /// Specifies the blob storage endpoint - /// (e.g. https://MyAccount.blob.core.windows.net). If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is - /// required. - /// Specifies the identifier key - /// of the auditing storage account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// Specifies the number of days to keep in /// the audit logs in the storage account. /// Specifies the Actions-Groups @@ -138,15 +120,13 @@ public ExtendedDatabaseBlobAuditingPolicy() /// /// For more information, see [Database-Level Audit /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - /// Specifies the blob - /// storage subscription Id. /// Specifies whether /// storageAccountAccessKey value is the storage's secondary /// key. /// Specifies whether audit /// events are sent to Azure Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -168,19 +148,39 @@ public ExtendedDatabaseBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + /// required. + /// Specifies the identifier key + /// of the auditing storage account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Specifies the blob + /// storage subscription Id. + public ExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { PredicateExpression = predicateExpression; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; CustomInit(); } @@ -196,41 +196,6 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.predicateExpression")] public string PredicateExpression { get; set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -317,12 +282,6 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -333,8 +292,8 @@ public ExtendedDatabaseBlobAuditingPolicy() /// /// Gets or sets specifies whether audit events are sent to Azure /// Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -364,6 +323,47 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs index f7e2e879b2bf..99347d827197 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs @@ -36,32 +36,34 @@ public ExtendedServerBlobAuditingPolicy() /// Initializes a new instance of the ExtendedServerBlobAuditingPolicy /// class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// Specifies the state of devops + /// audit. If state is Enabled, devops logs will be sent to Azure + /// Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// Specifies condition of where /// clause when creating an audit. - /// Specifies the blob storage endpoint - /// (e.g. https://MyAccount.blob.core.windows.net). If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is - /// required. - /// Specifies the identifier key - /// of the auditing storage account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// Specifies the number of days to keep in /// the audit logs in the storage account. /// Specifies the Actions-Groups @@ -138,15 +140,13 @@ public ExtendedServerBlobAuditingPolicy() /// /// For more information, see [Database-Level Audit /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - /// Specifies the blob - /// storage subscription Id. /// Specifies whether /// storageAccountAccessKey value is the storage's secondary /// key. /// Specifies whether audit /// events are sent to Azure Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -168,19 +168,40 @@ public ExtendedServerBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ExtendedServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + /// required. + /// Specifies the identifier key + /// of the auditing storage account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Specifies the blob + /// storage subscription Id. + public ExtendedServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), bool? isDevopsAuditEnabled = default(bool?), string predicateExpression = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { + IsDevopsAuditEnabled = isDevopsAuditEnabled; PredicateExpression = predicateExpression; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; CustomInit(); } @@ -189,6 +210,30 @@ public ExtendedServerBlobAuditingPolicy() /// partial void CustomInit(); + /// + /// Gets or sets specifies the state of devops audit. If state is + /// Enabled, devops logs will be sent to Azure Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// + /// + [JsonProperty(PropertyName = "properties.isDevopsAuditEnabled")] + public bool? IsDevopsAuditEnabled { get; set; } + /// /// Gets or sets specifies condition of where clause when creating an /// audit. @@ -196,41 +241,6 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.predicateExpression")] public string PredicateExpression { get; set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -317,12 +327,6 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -333,8 +337,8 @@ public ExtendedServerBlobAuditingPolicy() /// /// Gets or sets specifies whether audit events are sent to Azure /// Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -364,6 +368,47 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs index 904ce6567551..bd0e7df06d7c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs @@ -16,10 +16,10 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents a server firewall rule. + /// A server firewall rule. /// [Rest.Serialization.JsonTransformation] - public partial class FirewallRule : ProxyResource + public partial class FirewallRule : ProxyResourceWithWritableName { /// /// Initializes a new instance of the FirewallRule class. @@ -32,25 +32,19 @@ public FirewallRule() /// /// Initializes a new instance of the FirewallRule class. /// + /// Resource ID. + /// Resource name. + /// Resource type. /// The start IP address of the firewall - /// rule. Must be IPv4 format. Use value '0.0.0.0' to represent all + /// rule. Must be IPv4 format. Use value '0.0.0.0' for all /// Azure-internal IP addresses. /// The end IP address of the firewall rule. /// Must be IPv4 format. Must be greater than or equal to - /// startIpAddress. Use value '0.0.0.0' to represent all Azure-internal - /// IP addresses. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Kind of server that contains this firewall - /// rule. - /// Location of the server that contains this - /// firewall rule. - public FirewallRule(string startIpAddress, string endIpAddress, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string)) + /// startIpAddress. Use value '0.0.0.0' for all Azure-internal IP + /// addresses. + public FirewallRule(string id = default(string), string name = default(string), string type = default(string), string startIpAddress = default(string), string endIpAddress = default(string)) : base(id, name, type) { - Kind = kind; - Location = location; StartIpAddress = startIpAddress; EndIpAddress = endIpAddress; CustomInit(); @@ -61,21 +55,9 @@ public FirewallRule() /// partial void CustomInit(); - /// - /// Gets kind of server that contains this firewall rule. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Gets location of the server that contains this firewall rule. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - /// /// Gets or sets the start IP address of the firewall rule. Must be - /// IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP + /// IPv4 format. Use value '0.0.0.0' for all Azure-internal IP /// addresses. /// [JsonProperty(PropertyName = "properties.startIpAddress")] @@ -84,27 +66,10 @@ public FirewallRule() /// /// Gets or sets the end IP address of the firewall rule. Must be IPv4 /// format. Must be greater than or equal to startIpAddress. Use value - /// '0.0.0.0' to represent all Azure-internal IP addresses. + /// '0.0.0.0' for all Azure-internal IP addresses. /// [JsonProperty(PropertyName = "properties.endIpAddress")] public string EndIpAddress { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (StartIpAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "StartIpAddress"); - } - if (EndIpAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EndIpAddress"); - } - } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs similarity index 54% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs index 773e905009a0..f67a2e3e9864 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs @@ -11,29 +11,29 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Represents the parameters for Unlink Replication Link request. + /// A list of server firewall rules. /// - public partial class UnlinkParameters + public partial class FirewallRuleList { /// - /// Initializes a new instance of the UnlinkParameters class. + /// Initializes a new instance of the FirewallRuleList class. /// - public UnlinkParameters() + public FirewallRuleList() { CustomInit(); } /// - /// Initializes a new instance of the UnlinkParameters class. + /// Initializes a new instance of the FirewallRuleList class. /// - /// Determines whether link will be - /// terminated in a forced or a friendly way. - public UnlinkParameters(bool? forcedTermination = default(bool?)) + public FirewallRuleList(IList values = default(IList)) { - ForcedTermination = forcedTermination; + Values = values; CustomInit(); } @@ -43,11 +43,9 @@ public UnlinkParameters() partial void CustomInit(); /// - /// Gets or sets determines whether link will be terminated in a forced - /// or a friendly way. /// - [JsonProperty(PropertyName = "forcedTermination")] - public bool? ForcedTermination { get; set; } + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicy.cs deleted file mode 100644 index 541bd51ae9bc..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicy.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A database geo backup policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class GeoBackupPolicy : ProxyResource - { - /// - /// Initializes a new instance of the GeoBackupPolicy class. - /// - public GeoBackupPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GeoBackupPolicy class. - /// - /// The state of the geo backup policy. Possible - /// values include: 'Disabled', 'Enabled' - /// Resource ID. - /// Resource name. - /// Resource type. - /// The storage type of the geo backup - /// policy. - /// Kind of geo backup policy. This is metadata - /// used for the Azure portal experience. - /// Backup policy location. - public GeoBackupPolicy(GeoBackupPolicyState state, string id = default(string), string name = default(string), string type = default(string), string storageType = default(string), string kind = default(string), string location = default(string)) - : base(id, name, type) - { - State = state; - StorageType = storageType; - Kind = kind; - Location = location; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the state of the geo backup policy. Possible values - /// include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public GeoBackupPolicyState State { get; set; } - - /// - /// Gets the storage type of the geo backup policy. - /// - [JsonProperty(PropertyName = "properties.storageType")] - public string StorageType { get; private set; } - - /// - /// Gets kind of geo backup policy. This is metadata used for the - /// Azure portal experience. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Gets backup policy location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs new file mode 100644 index 000000000000..ee68141e4d1c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ImplementationMethod. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ImplementationMethod + { + [EnumMember(Value = "TSql")] + TSql, + [EnumMember(Value = "AzurePowerShell")] + AzurePowerShell + } + internal static class ImplementationMethodEnumExtension + { + internal static string ToSerializedValue(this ImplementationMethod? value) + { + return value == null ? null : ((ImplementationMethod)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ImplementationMethod value) + { + switch( value ) + { + case ImplementationMethod.TSql: + return "TSql"; + case ImplementationMethod.AzurePowerShell: + return "AzurePowerShell"; + } + return null; + } + + internal static ImplementationMethod? ParseImplementationMethod(this string value) + { + switch( value ) + { + case "TSql": + return ImplementationMethod.TSql; + case "AzurePowerShell": + return ImplementationMethod.AzurePowerShell; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs new file mode 100644 index 000000000000..37c40e7b1a1f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Extension operation result resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ImportExportExtensionsOperationResult : ProxyResource + { + /// + /// Initializes a new instance of the + /// ImportExportExtensionsOperationResult class. + /// + public ImportExportExtensionsOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ImportExportExtensionsOperationResult class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Request type. + /// Last modified time. + /// Server name. + /// Database name. + /// Operation status. + /// Error message. + public ImportExportExtensionsOperationResult(string id = default(string), string name = default(string), string type = default(string), System.Guid? requestId = default(System.Guid?), string requestType = default(string), string lastModifiedTime = default(string), string serverName = default(string), string databaseName = default(string), string status = default(string), string errorMessage = default(string)) + : base(id, name, type) + { + RequestId = requestId; + RequestType = requestType; + LastModifiedTime = lastModifiedTime; + ServerName = serverName; + DatabaseName = databaseName; + Status = status; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets request Id. + /// + [JsonProperty(PropertyName = "properties.requestId")] + public System.Guid? RequestId { get; private set; } + + /// + /// Gets request type. + /// + [JsonProperty(PropertyName = "properties.requestType")] + public string RequestType { get; private set; } + + /// + /// Gets last modified time. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public string LastModifiedTime { get; private set; } + + /// + /// Gets server name. + /// + [JsonProperty(PropertyName = "properties.serverName")] + public string ServerName { get; private set; } + + /// + /// Gets database name. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets operation status. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets error message. + /// + [JsonProperty(PropertyName = "properties.errorMessage")] + public string ErrorMessage { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs new file mode 100644 index 000000000000..5b3b688edca5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IsRetryable. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IsRetryable + { + [EnumMember(Value = "Yes")] + Yes, + [EnumMember(Value = "No")] + No + } + internal static class IsRetryableEnumExtension + { + internal static string ToSerializedValue(this IsRetryable? value) + { + return value == null ? null : ((IsRetryable)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IsRetryable value) + { + switch( value ) + { + case IsRetryable.Yes: + return "Yes"; + case IsRetryable.No: + return "No"; + } + return null; + } + + internal static IsRetryable? ParseIsRetryable(this string value) + { + switch( value ) + { + case "Yes": + return IsRetryable.Yes; + case "No": + return IsRetryable.No; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs index 1783bf647bac..53e42af56121 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs @@ -36,7 +36,7 @@ public JobSchedule() /// Whether or not the schedule is /// enabled. /// Value of the schedule's recurring interval, - /// if the schedule type is recurring. ISO8601 duration format. + /// if the ScheduleType is recurring. ISO8601 duration format. public JobSchedule(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), JobScheduleType? type = default(JobScheduleType?), bool? enabled = default(bool?), string interval = default(string)) { StartTime = startTime; @@ -79,7 +79,7 @@ public JobSchedule() /// /// Gets or sets value of the schedule's recurring interval, if the - /// schedule type is recurring. ISO8601 duration format. + /// ScheduleType is recurring. ISO8601 duration format. /// [JsonProperty(PropertyName = "interval")] public string Interval { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploads.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploads.cs new file mode 100644 index 000000000000..c88ea798864b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploads.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure SQL Database ledger digest upload settings. + /// + [Rest.Serialization.JsonTransformation] + public partial class LedgerDigestUploads : ProxyResource + { + /// + /// Initializes a new instance of the LedgerDigestUploads class. + /// + public LedgerDigestUploads() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LedgerDigestUploads class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The digest storage endpoint, + /// which must be either an Azure blob storage endpoint or an URI for + /// Azure Confidential Ledger. + /// Specifies the state of ledger digest upload. + /// Possible values include: 'Enabled', 'Disabled' + public LedgerDigestUploads(string id = default(string), string name = default(string), string type = default(string), string digestStorageEndpoint = default(string), LedgerDigestUploadsState? state = default(LedgerDigestUploadsState?)) + : base(id, name, type) + { + DigestStorageEndpoint = digestStorageEndpoint; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the digest storage endpoint, which must be either an + /// Azure blob storage endpoint or an URI for Azure Confidential + /// Ledger. + /// + [JsonProperty(PropertyName = "properties.digestStorageEndpoint")] + public string DigestStorageEndpoint { get; set; } + + /// + /// Gets specifies the state of ledger digest upload. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public LedgerDigestUploadsState? State { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicyState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploadsState.cs similarity index 57% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicyState.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploadsState.cs index bea4eaa01cd6..bffe1059cfae 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/GeoBackupPolicyState.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploadsState.cs @@ -16,43 +16,43 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for GeoBackupPolicyState. + /// Defines values for LedgerDigestUploadsState. /// [JsonConverter(typeof(StringEnumConverter))] - public enum GeoBackupPolicyState + public enum LedgerDigestUploadsState { - [EnumMember(Value = "Disabled")] - Disabled, [EnumMember(Value = "Enabled")] - Enabled + Enabled, + [EnumMember(Value = "Disabled")] + Disabled } - internal static class GeoBackupPolicyStateEnumExtension + internal static class LedgerDigestUploadsStateEnumExtension { - internal static string ToSerializedValue(this GeoBackupPolicyState? value) + internal static string ToSerializedValue(this LedgerDigestUploadsState? value) { - return value == null ? null : ((GeoBackupPolicyState)value).ToSerializedValue(); + return value == null ? null : ((LedgerDigestUploadsState)value).ToSerializedValue(); } - internal static string ToSerializedValue(this GeoBackupPolicyState value) + internal static string ToSerializedValue(this LedgerDigestUploadsState value) { switch( value ) { - case GeoBackupPolicyState.Disabled: - return "Disabled"; - case GeoBackupPolicyState.Enabled: + case LedgerDigestUploadsState.Enabled: return "Enabled"; + case LedgerDigestUploadsState.Disabled: + return "Disabled"; } return null; } - internal static GeoBackupPolicyState? ParseGeoBackupPolicyState(this string value) + internal static LedgerDigestUploadsState? ParseLedgerDigestUploadsState(this string value) { switch( value ) { - case "Disabled": - return GeoBackupPolicyState.Disabled; case "Enabled": - return GeoBackupPolicyState.Enabled; + return LedgerDigestUploadsState.Enabled; + case "Disabled": + return LedgerDigestUploadsState.Disabled; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs index f9e10892ef90..fc1214b24fa8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs @@ -16,33 +16,33 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents a database transparent data encryption configuration. + /// A logical database transparent data encryption state. /// [Rest.Serialization.JsonTransformation] - public partial class TransparentDataEncryption : ProxyResource + public partial class LogicalDatabaseTransparentDataEncryption : ProxyResource { /// - /// Initializes a new instance of the TransparentDataEncryption class. + /// Initializes a new instance of the + /// LogicalDatabaseTransparentDataEncryption class. /// - public TransparentDataEncryption() + public LogicalDatabaseTransparentDataEncryption() { CustomInit(); } /// - /// Initializes a new instance of the TransparentDataEncryption class. + /// Initializes a new instance of the + /// LogicalDatabaseTransparentDataEncryption class. /// + /// Specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// Resource location. - /// The status of the database transparent data - /// encryption. Possible values include: 'Enabled', 'Disabled' - public TransparentDataEncryption(string id = default(string), string name = default(string), string type = default(string), string location = default(string), TransparentDataEncryptionStatus? status = default(TransparentDataEncryptionStatus?)) + public LogicalDatabaseTransparentDataEncryption(TransparentDataEncryptionState state, string id = default(string), string name = default(string), string type = default(string)) : base(id, name, type) { - Location = location; - Status = status; + State = state; CustomInit(); } @@ -52,17 +52,20 @@ public TransparentDataEncryption() partial void CustomInit(); /// - /// Gets resource location. + /// Gets or sets specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } + [JsonProperty(PropertyName = "properties.state")] + public TransparentDataEncryptionState State { get; set; } /// - /// Gets or sets the status of the database transparent data - /// encryption. Possible values include: 'Enabled', 'Disabled' + /// Validate the object. /// - [JsonProperty(PropertyName = "properties.status")] - public TransparentDataEncryptionStatus? Status { get; set; } - + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs new file mode 100644 index 000000000000..273a7183ee73 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Maintenance window options. + /// + [Rest.Serialization.JsonTransformation] + public partial class MaintenanceWindowOptions : ProxyResource + { + /// + /// Initializes a new instance of the MaintenanceWindowOptions class. + /// + public MaintenanceWindowOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindowOptions class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Whether maintenance windows are enabled for + /// the database. + /// Available maintenance cycles + /// e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. + /// Minimum duration of maintenance + /// window. + /// Default duration for + /// maintenance window. + /// Minimum number of maintenance windows + /// cycles to be set on the database. + /// Time granularity in minutes + /// for maintenance windows. + /// Whether we + /// allow multiple maintenance windows per cycle. + public MaintenanceWindowOptions(string id = default(string), string name = default(string), string type = default(string), bool? isEnabled = default(bool?), IList maintenanceWindowCycles = default(IList), int? minDurationInMinutes = default(int?), int? defaultDurationInMinutes = default(int?), int? minCycles = default(int?), int? timeGranularityInMinutes = default(int?), bool? allowMultipleMaintenanceWindowsPerCycle = default(bool?)) + : base(id, name, type) + { + IsEnabled = isEnabled; + MaintenanceWindowCycles = maintenanceWindowCycles; + MinDurationInMinutes = minDurationInMinutes; + DefaultDurationInMinutes = defaultDurationInMinutes; + MinCycles = minCycles; + TimeGranularityInMinutes = timeGranularityInMinutes; + AllowMultipleMaintenanceWindowsPerCycle = allowMultipleMaintenanceWindowsPerCycle; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether maintenance windows are enabled for the + /// database. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets available maintenance cycles e.g. {Saturday, 0, + /// 48*60}, {Wednesday, 0, 24*60}. + /// + [JsonProperty(PropertyName = "properties.maintenanceWindowCycles")] + public IList MaintenanceWindowCycles { get; set; } + + /// + /// Gets or sets minimum duration of maintenance window. + /// + [JsonProperty(PropertyName = "properties.minDurationInMinutes")] + public int? MinDurationInMinutes { get; set; } + + /// + /// Gets or sets default duration for maintenance window. + /// + [JsonProperty(PropertyName = "properties.defaultDurationInMinutes")] + public int? DefaultDurationInMinutes { get; set; } + + /// + /// Gets or sets minimum number of maintenance windows cycles to be set + /// on the database. + /// + [JsonProperty(PropertyName = "properties.minCycles")] + public int? MinCycles { get; set; } + + /// + /// Gets or sets time granularity in minutes for maintenance windows. + /// + [JsonProperty(PropertyName = "properties.timeGranularityInMinutes")] + public int? TimeGranularityInMinutes { get; set; } + + /// + /// Gets or sets whether we allow multiple maintenance windows per + /// cycle. + /// + [JsonProperty(PropertyName = "properties.allowMultipleMaintenanceWindowsPerCycle")] + public bool? AllowMultipleMaintenanceWindowsPerCycle { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs new file mode 100644 index 000000000000..7facd2eceb7b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Maintenance window time range. + /// + public partial class MaintenanceWindowTimeRange + { + /// + /// Initializes a new instance of the MaintenanceWindowTimeRange class. + /// + public MaintenanceWindowTimeRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindowTimeRange class. + /// + /// Day of maintenance window. Possible values + /// include: 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', + /// 'Friday', 'Saturday' + /// Start time minutes offset from + /// 12am. + /// Duration of maintenance window in + /// minutes. + public MaintenanceWindowTimeRange(string dayOfWeek = default(string), string startTime = default(string), string duration = default(string)) + { + DayOfWeek = dayOfWeek; + StartTime = startTime; + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets day of maintenance window. Possible values include: + /// 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', + /// 'Saturday' + /// + [JsonProperty(PropertyName = "dayOfWeek")] + public string DayOfWeek { get; set; } + + /// + /// Gets or sets start time minutes offset from 12am. + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets duration of maintenance window in minutes. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs new file mode 100644 index 000000000000..ec47bb8fc07f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Maintenance windows. + /// + [Rest.Serialization.JsonTransformation] + public partial class MaintenanceWindows : ProxyResource + { + /// + /// Initializes a new instance of the MaintenanceWindows class. + /// + public MaintenanceWindows() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindows class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public MaintenanceWindows(string id = default(string), string name = default(string), string type = default(string), IList timeRanges = default(IList)) + : base(id, name, type) + { + TimeRanges = timeRanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.timeRanges")] + public IList TimeRanges { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs index a635deee6139..5f40faae050d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs @@ -46,7 +46,7 @@ public ManagedDatabaseSecurityAlertPolicy() /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -91,7 +91,7 @@ public ManagedDatabaseSecurityAlertPolicy() /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs index 05f56db02fc0..500c206ee3af 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs @@ -118,7 +118,13 @@ public ManagedInstance() /// 'ZRS' /// Whether or not the multi-az is /// enabled. - public ManagedInstance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?)) + /// The resource id of a + /// user assigned identity to be used by default. + /// A CMK URI of the key to use for + /// encryption. + /// The Azure Active Directory + /// administrator of the server. + public ManagedInstance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), Sku sku = default(Sku), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ManagedInstanceExternalAdministrator administrators = default(ManagedInstanceExternalAdministrator)) : base(location, id, name, type, tags) { Identity = identity; @@ -147,6 +153,9 @@ public ManagedInstance() MinimalTlsVersion = minimalTlsVersion; StorageAccountType = storageAccountType; ZoneRedundant = zoneRedundant; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; CustomInit(); } @@ -160,7 +169,7 @@ public ManagedInstance() /// instance. /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets or sets managed instance SKU. Allowed values for sku.name: @@ -350,6 +359,26 @@ public ManagedInstance() [JsonProperty(PropertyName = "properties.zoneRedundant")] public bool? ZoneRedundant { get; set; } + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory administrator of the + /// server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs index 10a41136245f..1900f3a295c5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs @@ -46,7 +46,9 @@ public ManagedInstanceEncryptionProtector() /// key. /// The URI of the server key. /// Thumbprint of the server key. - public ManagedInstanceEncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ManagedInstanceEncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -54,6 +56,7 @@ public ManagedInstanceEncryptionProtector() ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -95,6 +98,12 @@ public ManagedInstanceEncryptionProtector() [JsonProperty(PropertyName = "properties.thumbprint")] public string Thumbprint { get; private set; } + /// + /// Gets or sets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs new file mode 100644 index 000000000000..687498eceb43 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a active directory administrator. + /// + public partial class ManagedInstanceExternalAdministrator + { + /// + /// Initializes a new instance of the + /// ManagedInstanceExternalAdministrator class. + /// + public ManagedInstanceExternalAdministrator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstanceExternalAdministrator class. + /// + /// Type of the sever administrator. + /// Possible values include: 'ActiveDirectory' + /// Principal Type of the sever + /// administrator. Possible values include: 'User', 'Group', + /// 'Application' + /// Login name of the server administrator. + /// SID (object ID) of the server + /// administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only + /// Authentication enabled. + public ManagedInstanceExternalAdministrator(string administratorType = default(string), string principalType = default(string), string login = default(string), System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), bool? azureADOnlyAuthentication = default(bool?)) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the sever administrator. Possible values + /// include: 'ActiveDirectory' + /// + [JsonProperty(PropertyName = "administratorType")] + public string AdministratorType { get; set; } + + /// + /// Gets or sets principal Type of the sever administrator. Possible + /// values include: 'User', 'Group', 'Application' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets login name of the server administrator. + /// + [JsonProperty(PropertyName = "login")] + public string Login { get; set; } + + /// + /// Gets or sets SID (object ID) of the server administrator. + /// + [JsonProperty(PropertyName = "sid")] + public System.Guid? Sid { get; set; } + + /// + /// Gets or sets tenant ID of the administrator. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets azure Active Directory only Authentication enabled. + /// + [JsonProperty(PropertyName = "azureADOnlyAuthentication")] + public bool? AzureADOnlyAuthentication { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs index da6ab159a907..c813629cdbff 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs @@ -44,7 +44,9 @@ public ManagedInstanceKey() /// AzureKeyVault, then the URI is required. /// Thumbprint of the key. /// The key creation date. - public ManagedInstanceKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ManagedInstanceKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -52,6 +54,7 @@ public ManagedInstanceKey() Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -93,6 +96,12 @@ public ManagedInstanceKey() [JsonProperty(PropertyName = "properties.creationDate")] public System.DateTime? CreationDate { get; private set; } + /// + /// Gets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs index a9b4529edcc4..d8a0ca93edcf 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs @@ -48,7 +48,10 @@ public ManagedInstanceLongTermRetentionBackup() /// The time the backup was taken /// The time the long term retention /// backup will expire. - public ManagedInstanceLongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string managedInstanceName = default(string), System.DateTime? managedInstanceCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?)) + /// The storage redundancy type + /// of the backup. Possible values include: 'Geo', 'Local', + /// 'Zone' + public ManagedInstanceLongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string managedInstanceName = default(string), System.DateTime? managedInstanceCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?), string backupStorageRedundancy = default(string)) : base(id, name, type) { ManagedInstanceName = managedInstanceName; @@ -57,6 +60,7 @@ public ManagedInstanceLongTermRetentionBackup() DatabaseDeletionTime = databaseDeletionTime; BackupTime = backupTime; BackupExpirationTime = backupExpirationTime; + BackupStorageRedundancy = backupStorageRedundancy; CustomInit(); } @@ -101,5 +105,12 @@ public ManagedInstanceLongTermRetentionBackup() [JsonProperty(PropertyName = "properties.backupExpirationTime")] public System.DateTime? BackupExpirationTime { get; private set; } + /// + /// Gets the storage redundancy type of the backup. Possible values + /// include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.backupStorageRedundancy")] + public string BackupStorageRedundancy { get; private set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs new file mode 100644 index 000000000000..ca721689170a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A private endpoint connection + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstancePrivateEndpointConnection : ProxyResource + { + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateEndpointConnection class. + /// + public ManagedInstancePrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateEndpointConnection class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Private endpoint which the connection + /// belongs to. + /// Connection State of + /// the Private Endpoint Connection. + /// State of the Private Endpoint + /// Connection. + public ManagedInstancePrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), ManagedInstancePrivateEndpointProperty privateEndpoint = default(ManagedInstancePrivateEndpointProperty), ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(ManagedInstancePrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets private endpoint which the connection belongs to. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public ManagedInstancePrivateEndpointProperty PrivateEndpoint { get; set; } + + /// + /// Gets or sets connection State of the Private Endpoint Connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public ManagedInstancePrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets state of the Private Endpoint Connection. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState != null) + { + PrivateLinkServiceConnectionState.Validate(); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs new file mode 100644 index 000000000000..a3740cedf6b0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A private link resource + /// + public partial class ManagedInstancePrivateLink : ProxyResource + { + /// + /// Initializes a new instance of the ManagedInstancePrivateLink class. + /// + public ManagedInstancePrivateLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedInstancePrivateLink class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The private link resource group + /// id. + public ManagedInstancePrivateLink(string id = default(string), string name = default(string), string type = default(string), ManagedInstancePrivateLinkProperties properties = default(ManagedInstancePrivateLinkProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties")] + public ManagedInstancePrivateLinkProperties Properties { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs new file mode 100644 index 000000000000..9ae922258c97 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a private link resource. + /// + public partial class ManagedInstancePrivateLinkProperties + { + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateLinkProperties class. + /// + public ManagedInstancePrivateLinkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateLinkProperties class. + /// + /// The private link resource group id. + /// The private link resource required + /// member names. + public ManagedInstancePrivateLinkProperties(string groupId = default(string), IList requiredMembers = default(IList)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "requiredMembers")] + public IList RequiredMembers { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs new file mode 100644 index 000000000000..97413b6b8744 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database query. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstanceQuery : ProxyResource + { + /// + /// Initializes a new instance of the ManagedInstanceQuery class. + /// + public ManagedInstanceQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedInstanceQuery class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Query text. + public ManagedInstanceQuery(string id = default(string), string name = default(string), string type = default(string), string queryText = default(string)) + : base(id, name, type) + { + QueryText = queryText; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets query text. + /// + [JsonProperty(PropertyName = "properties.queryText")] + public string QueryText { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs index 7345937a002c..6053e461398d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs @@ -111,8 +111,14 @@ public ManagedInstanceUpdate() /// 'ZRS' /// Whether or not the multi-az is /// enabled. + /// The resource id of a + /// user assigned identity to be used by default. + /// A CMK URI of the key to use for + /// encryption. + /// The Azure Active Directory + /// administrator of the server. /// Resource tags. - public ManagedInstanceUpdate(Sku sku = default(Sku), ResourceIdentity identity = default(ResourceIdentity), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), IDictionary tags = default(IDictionary)) + public ManagedInstanceUpdate(Sku sku = default(Sku), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ManagedInstanceExternalAdministrator administrators = default(ManagedInstanceExternalAdministrator), IDictionary tags = default(IDictionary)) { Sku = sku; Identity = identity; @@ -140,6 +146,9 @@ public ManagedInstanceUpdate() MinimalTlsVersion = minimalTlsVersion; StorageAccountType = storageAccountType; ZoneRedundant = zoneRedundant; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; Tags = tags; CustomInit(); } @@ -159,7 +168,7 @@ public ManagedInstanceUpdate() /// Gets or sets managed instance identity /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets possible values include: 'Creating', 'Deleting', 'Updating', @@ -342,6 +351,26 @@ public ManagedInstanceUpdate() [JsonProperty(PropertyName = "properties.zoneRedundant")] public bool? ZoneRedundant { get; set; } + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory administrator of the + /// server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs index 7c46e6d77625..aec229e8d1eb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs @@ -41,8 +41,8 @@ public ManagedInstanceVulnerabilityAssessment() /// Resource name. /// Resource type. /// A shared access signature (SAS - /// Key) that has read and write access to the blob container specified - /// in 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// Key) that has write access to the blob container specified in + /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' /// isn't specified, StorageContainerSasKey is required. /// Specifies the identifier key /// of the storage account for vulnerability assessment scan results. @@ -72,10 +72,10 @@ public ManagedInstanceVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets a shared access signature (SAS Key) that has read and - /// write access to the blob container specified in - /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' - /// isn't specified, StorageContainerSasKey is required. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs index 087d97a1540b..af0e9b52e880 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs @@ -38,15 +38,17 @@ public ManagedServerSecurityAlertPolicy() /// /// Specifies the state of the policy, whether it /// is enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', + /// specific database. Possible values include: 'Enabled', /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of + /// SecurityAlertPolicyResource. /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -60,9 +62,10 @@ public ManagedServerSecurityAlertPolicy() /// the Threat Detection audit logs. /// Specifies the UTC creation time of the /// policy. - public ManagedServerSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) + public ManagedServerSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -79,19 +82,24 @@ public ManagedServerSecurityAlertPolicy() /// partial void CustomInit(); + /// + /// Gets systemData of SecurityAlertPolicyResource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Gets or sets specifies the state of the policy, whether it is /// enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', - /// 'Disabled' + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs new file mode 100644 index 000000000000..bc98f447cce4 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A managed database transparent data encryption state. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedTransparentDataEncryption : ProxyResource + { + /// + /// Initializes a new instance of the ManagedTransparentDataEncryption + /// class. + /// + public ManagedTransparentDataEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedTransparentDataEncryption + /// class. + /// + /// Specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + /// Resource ID. + /// Resource name. + /// Resource type. + public ManagedTransparentDataEncryption(TransparentDataEncryptionState state, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public TransparentDataEncryptionState State { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Metric.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Metric.cs deleted file mode 100644 index c2f7e0249613..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Metric.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Database metrics. - /// - public partial class Metric - { - /// - /// Initializes a new instance of the Metric class. - /// - public Metric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Metric class. - /// - /// The start time for the metric (ISO-8601 - /// format). - /// The end time for the metric (ISO-8601 - /// format). - /// The time step to be used to summarize the - /// metric values. - /// The unit of the metric. Possible values include: - /// 'count', 'bytes', 'seconds', 'percent', 'countPerSecond', - /// 'bytesPerSecond' - /// The name information for the metric. - /// The metric values for the specified time - /// window and timestep. - public Metric(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string timeGrain = default(string), string unit = default(string), MetricName name = default(MetricName), IList metricValues = default(IList)) - { - StartTime = startTime; - EndTime = endTime; - TimeGrain = timeGrain; - Unit = unit; - Name = name; - MetricValues = metricValues; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the start time for the metric (ISO-8601 format). - /// - [JsonProperty(PropertyName = "startTime")] - public System.DateTime? StartTime { get; private set; } - - /// - /// Gets the end time for the metric (ISO-8601 format). - /// - [JsonProperty(PropertyName = "endTime")] - public System.DateTime? EndTime { get; private set; } - - /// - /// Gets the time step to be used to summarize the metric values. - /// - [JsonProperty(PropertyName = "timeGrain")] - public string TimeGrain { get; private set; } - - /// - /// Gets the unit of the metric. Possible values include: 'count', - /// 'bytes', 'seconds', 'percent', 'countPerSecond', 'bytesPerSecond' - /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; private set; } - - /// - /// Gets the name information for the metric. - /// - [JsonProperty(PropertyName = "name")] - public MetricName Name { get; private set; } - - /// - /// Gets the metric values for the specified time window and timestep. - /// - [JsonProperty(PropertyName = "metricValues")] - public IList MetricValues { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricAvailability.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricAvailability.cs deleted file mode 100644 index 7858019de8a6..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricAvailability.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A metric availability value. - /// - public partial class MetricAvailability - { - /// - /// Initializes a new instance of the MetricAvailability class. - /// - public MetricAvailability() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAvailability class. - /// - /// The length of retention for the database - /// metric. - /// The granularity of the database - /// metric. - public MetricAvailability(string retention = default(string), string timeGrain = default(string)) - { - Retention = retention; - TimeGrain = timeGrain; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the length of retention for the database metric. - /// - [JsonProperty(PropertyName = "retention")] - public string Retention { get; private set; } - - /// - /// Gets the granularity of the database metric. - /// - [JsonProperty(PropertyName = "timeGrain")] - public string TimeGrain { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricDefinition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricDefinition.cs deleted file mode 100644 index 5bd07c0d50f1..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricDefinition.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A database metric definition. - /// - public partial class MetricDefinition - { - /// - /// Initializes a new instance of the MetricDefinition class. - /// - public MetricDefinition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricDefinition class. - /// - /// The name information for the metric. - /// The primary aggregation type - /// defining how metric values are displayed. Possible values include: - /// 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - /// The resource uri of the database. - /// The unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', - /// 'BytesPerSecond' - /// The list of database metric - /// availabilities for the metric. - public MetricDefinition(MetricName name = default(MetricName), string primaryAggregationType = default(string), string resourceUri = default(string), string unit = default(string), IList metricAvailabilities = default(IList)) - { - Name = name; - PrimaryAggregationType = primaryAggregationType; - ResourceUri = resourceUri; - Unit = unit; - MetricAvailabilities = metricAvailabilities; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the name information for the metric. - /// - [JsonProperty(PropertyName = "name")] - public MetricName Name { get; private set; } - - /// - /// Gets the primary aggregation type defining how metric values are - /// displayed. Possible values include: 'None', 'Average', 'Count', - /// 'Minimum', 'Maximum', 'Total' - /// - [JsonProperty(PropertyName = "primaryAggregationType")] - public string PrimaryAggregationType { get; private set; } - - /// - /// Gets the resource uri of the database. - /// - [JsonProperty(PropertyName = "resourceUri")] - public string ResourceUri { get; private set; } - - /// - /// Gets the unit of the metric. Possible values include: 'Count', - /// 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' - /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; private set; } - - /// - /// Gets the list of database metric availabilities for the metric. - /// - [JsonProperty(PropertyName = "metricAvailabilities")] - public IList MetricAvailabilities { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricName.cs deleted file mode 100644 index 1132e41454bd..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricName.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A database metric name. - /// - public partial class MetricName - { - /// - /// Initializes a new instance of the MetricName class. - /// - public MetricName() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricName class. - /// - /// The name of the database metric. - /// The friendly name of the database - /// metric. - public MetricName(string value = default(string), string localizedValue = default(string)) - { - Value = value; - LocalizedValue = localizedValue; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the name of the database metric. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; private set; } - - /// - /// Gets the friendly name of the database metric. - /// - [JsonProperty(PropertyName = "localizedValue")] - public string LocalizedValue { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricValue.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricValue.cs deleted file mode 100644 index 21c34da50d51..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MetricValue.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents database metrics. - /// - public partial class MetricValue - { - /// - /// Initializes a new instance of the MetricValue class. - /// - public MetricValue() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricValue class. - /// - /// The number of values for the metric. - /// The average value of the metric. - /// The max value of the metric. - /// The min value of the metric. - /// The metric timestamp (ISO-8601 - /// format). - /// The total value of the metric. - public MetricValue(double? count = default(double?), double? average = default(double?), double? maximum = default(double?), double? minimum = default(double?), System.DateTime? timestamp = default(System.DateTime?), double? total = default(double?)) - { - Count = count; - Average = average; - Maximum = maximum; - Minimum = minimum; - Timestamp = timestamp; - Total = total; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the number of values for the metric. - /// - [JsonProperty(PropertyName = "count")] - public double? Count { get; private set; } - - /// - /// Gets the average value of the metric. - /// - [JsonProperty(PropertyName = "average")] - public double? Average { get; private set; } - - /// - /// Gets the max value of the metric. - /// - [JsonProperty(PropertyName = "maximum")] - public double? Maximum { get; private set; } - - /// - /// Gets the min value of the metric. - /// - [JsonProperty(PropertyName = "minimum")] - public double? Minimum { get; private set; } - - /// - /// Gets the metric timestamp (ISO-8601 format). - /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; private set; } - - /// - /// Gets the total value of the metric. - /// - [JsonProperty(PropertyName = "total")] - public double? Total { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationImpact.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationImpact.cs deleted file mode 100644 index 541c766fc0d2..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationImpact.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The impact of an operation, both in absolute and relative terms. - /// - public partial class OperationImpact - { - /// - /// Initializes a new instance of the OperationImpact class. - /// - public OperationImpact() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationImpact class. - /// - /// The name of the impact dimension. - /// The unit in which estimated impact to dimension - /// is measured. - /// The absolute impact to - /// dimension. - /// The relative impact to dimension - /// (null if not applicable) - public OperationImpact(string name = default(string), string unit = default(string), double? changeValueAbsolute = default(double?), double? changeValueRelative = default(double?)) - { - Name = name; - Unit = unit; - ChangeValueAbsolute = changeValueAbsolute; - ChangeValueRelative = changeValueRelative; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the name of the impact dimension. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the unit in which estimated impact to dimension is measured. - /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; private set; } - - /// - /// Gets the absolute impact to dimension. - /// - [JsonProperty(PropertyName = "changeValueAbsolute")] - public double? ChangeValueAbsolute { get; private set; } - - /// - /// Gets the relative impact to dimension (null if not applicable) - /// - [JsonProperty(PropertyName = "changeValueRelative")] - public double? ChangeValueRelative { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs new file mode 100644 index 000000000000..f1b9c6f97616 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operations health status in a location. + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationsHealth : ProxyResource + { + /// + /// Initializes a new instance of the OperationsHealth class. + /// + public OperationsHealth() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsHealth class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Operation name for the + /// service + /// Operation health status of the + /// service. + /// Health status description. + public OperationsHealth(string id = default(string), string name = default(string), string type = default(string), string operationsHealthName = default(string), string health = default(string), string description = default(string)) + : base(id, name, type) + { + OperationsHealthName = operationsHealthName; + Health = health; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name for the service + /// + [JsonProperty(PropertyName = "properties.name")] + public string OperationsHealthName { get; private set; } + + /// + /// Gets operation health status of the service. + /// + [JsonProperty(PropertyName = "properties.health")] + public string Health { get; private set; } + + /// + /// Gets health status description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundFirewallRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundFirewallRule.cs new file mode 100644 index 000000000000..d3eaf96d79f8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundFirewallRule.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Azure SQL DB Server Outbound Firewall Rule. + /// + [Rest.Serialization.JsonTransformation] + public partial class OutboundFirewallRule : ProxyResource + { + /// + /// Initializes a new instance of the OutboundFirewallRule class. + /// + public OutboundFirewallRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OutboundFirewallRule class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of the outbound + /// rule. + public OutboundFirewallRule(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the state of the outbound rule. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page.cs index 805972f112b6..eef4422cbe12 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page.cs @@ -26,7 +26,7 @@ public class Page : IPage /// /// Gets the link to the next page. /// - [JsonProperty("")] + [JsonProperty("nextLink")] public string NextPageLink { get; private set; } [JsonProperty("value")] diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page1.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page1.cs deleted file mode 100644 index 640ba4f5fd4f..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Page1.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - - /// - /// Defines a page in Azure responses. - /// - /// Type of the page content items - [JsonObject] - public class Page1 : IPage - { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs similarity index 61% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationState.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs index 067c14bdb345..79ae75393c7c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationState.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs @@ -12,13 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for ReplicationState. + /// Defines values for PrincipalType. /// - public static class ReplicationState + public static class PrincipalType { - public const string PENDING = "PENDING"; - public const string SEEDING = "SEEDING"; - public const string CATCHUP = "CATCH_UP"; - public const string SUSPENDED = "SUSPENDED"; + public const string User = "User"; + public const string Group = "Group"; + public const string Application = "Application"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs index 1c06729a4501..cf8ae819975c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs @@ -36,10 +36,13 @@ public PrivateLinkResourceProperties() /// The private link resource group id. /// The private link resource required /// member names. - public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList)) + /// The private link resource required + /// zone names. + public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) { GroupId = groupId; RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; CustomInit(); } @@ -60,5 +63,11 @@ public PrivateLinkResourceProperties() [JsonProperty(PropertyName = "requiredMembers")] public IList RequiredMembers { get; private set; } + /// + /// Gets the private link resource required zone names. + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; private set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs new file mode 100644 index 000000000000..5ad21835e87b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.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; + + /// + /// ARM proxy resource. + /// + public partial class ProxyResourceWithWritableName : ResourceWithWritableName + { + /// + /// Initializes a new instance of the ProxyResourceWithWritableName + /// class. + /// + public ProxyResourceWithWritableName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResourceWithWritableName + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public ProxyResourceWithWritableName(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs new file mode 100644 index 000000000000..40f0e404e1bf --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class QueryStatistics : ProxyResource + { + /// + /// Initializes a new instance of the QueryStatistics class. + /// + public QueryStatistics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryStatistics class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Database name of the database in which + /// this query was executed. + /// Unique query id (unique within one + /// database). + /// The start time for the metric (ISO-8601 + /// format). + /// The end time for the metric (ISO-8601 + /// format). + /// List of intervals with appropriate metric + /// data + public QueryStatistics(string id = default(string), string name = default(string), string type = default(string), string databaseName = default(string), string queryId = default(string), string startTime = default(string), string endTime = default(string), IList intervals = default(IList)) + : base(id, name, type) + { + DatabaseName = databaseName; + QueryId = queryId; + StartTime = startTime; + EndTime = endTime; + Intervals = intervals; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets database name of the database in which this query was + /// executed. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets unique query id (unique within one database). + /// + [JsonProperty(PropertyName = "properties.queryId")] + public string QueryId { get; private set; } + + /// + /// Gets the start time for the metric (ISO-8601 format). + /// + [JsonProperty(PropertyName = "properties.startTime")] + public string StartTime { get; private set; } + + /// + /// Gets the end time for the metric (ISO-8601 format). + /// + [JsonProperty(PropertyName = "properties.endTime")] + public string EndTime { get; private set; } + + /// + /// Gets or sets list of intervals with appropriate metric data + /// + [JsonProperty(PropertyName = "properties.intervals")] + public IList Intervals { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs new file mode 100644 index 000000000000..1b39ec23315c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs @@ -0,0 +1,320 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Database, Server or Elastic Pool Recommended Action. + /// + [Rest.Serialization.JsonTransformation] + public partial class RecommendedAction : ProxyResource + { + /// + /// Initializes a new instance of the RecommendedAction class. + /// + public RecommendedAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedAction class. + /// + /// Gets the info of the current state the + /// recommended action is in. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource kind. + /// Resource location. + /// Gets the reason for recommending + /// this action. e.g., DuplicateIndex + /// Gets the time since when this recommended + /// action is valid. + /// Gets time when this recommended action + /// was last refreshed. + /// Gets if this recommended action is + /// actionable by user + /// Gets if changes applied by this + /// recommended action can be reverted by user + /// Gets if this recommended action was + /// suggested some time ago but user chose to ignore this and system + /// added a new recommended action again. + /// Gets the time when system + /// started applying this recommended action on the user resource. + /// e.g., index creation start time + /// Gets the time taken for + /// applying this recommended action on user resource. e.g., time taken + /// for index creation + /// Gets the time when system + /// started reverting changes of this recommended action on user + /// resource. e.g., time when index drop is executed. + /// Gets the time taken for + /// reverting changes of this recommended action on user resource. + /// e.g., time taken for dropping the created index. + /// Gets if approval for + /// applying this recommended action was given by user/system. Possible + /// values include: 'User', 'System' + /// Gets the time when this + /// recommended action was approved for execution. + /// Gets if approval for + /// reverting this recommended action was given by user/system. + /// Possible values include: 'User', 'System' + /// Gets the time when this + /// recommended action was approved for revert. + /// Gets the impact of this recommended action. + /// Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High + /// Impact + /// Gets the implementation details + /// of this recommended action for user to apply it manually. + /// Gets the error details if and why this + /// recommended action is put to error state. + /// Gets the estimated impact info for + /// this recommended action e.g., Estimated CPU gain, Estimated Disk + /// Space change + /// Gets the observed/actual impact info + /// for this recommended action e.g., Actual CPU gain, Actual Disk + /// Space change + /// Gets the time series info of metrics for + /// this recommended action e.g., CPU consumption time series + /// Gets the linked objects, if + /// any. + /// Gets additional details specific to this + /// recommended action. + public RecommendedAction(RecommendedActionStateInfo state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string recommendationReason = default(string), System.DateTime? validSince = default(System.DateTime?), System.DateTime? lastRefresh = default(System.DateTime?), bool? isExecutableAction = default(bool?), bool? isRevertableAction = default(bool?), bool? isArchivedAction = default(bool?), System.DateTime? executeActionStartTime = default(System.DateTime?), string executeActionDuration = default(string), System.DateTime? revertActionStartTime = default(System.DateTime?), string revertActionDuration = default(string), RecommendedActionInitiatedBy? executeActionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? executeActionInitiatedTime = default(System.DateTime?), RecommendedActionInitiatedBy? revertActionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? revertActionInitiatedTime = default(System.DateTime?), int? score = default(int?), RecommendedActionImplementationInfo implementationDetails = default(RecommendedActionImplementationInfo), RecommendedActionErrorInfo errorDetails = default(RecommendedActionErrorInfo), IList estimatedImpact = default(IList), IList observedImpact = default(IList), IList timeSeries = default(IList), IList linkedObjects = default(IList), IDictionary details = default(IDictionary)) + : base(id, name, type) + { + Kind = kind; + Location = location; + RecommendationReason = recommendationReason; + ValidSince = validSince; + LastRefresh = lastRefresh; + State = state; + IsExecutableAction = isExecutableAction; + IsRevertableAction = isRevertableAction; + IsArchivedAction = isArchivedAction; + ExecuteActionStartTime = executeActionStartTime; + ExecuteActionDuration = executeActionDuration; + RevertActionStartTime = revertActionStartTime; + RevertActionDuration = revertActionDuration; + ExecuteActionInitiatedBy = executeActionInitiatedBy; + ExecuteActionInitiatedTime = executeActionInitiatedTime; + RevertActionInitiatedBy = revertActionInitiatedBy; + RevertActionInitiatedTime = revertActionInitiatedTime; + Score = score; + ImplementationDetails = implementationDetails; + ErrorDetails = errorDetails; + EstimatedImpact = estimatedImpact; + ObservedImpact = observedImpact; + TimeSeries = timeSeries; + LinkedObjects = linkedObjects; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the reason for recommending this action. e.g., DuplicateIndex + /// + [JsonProperty(PropertyName = "properties.recommendationReason")] + public string RecommendationReason { get; private set; } + + /// + /// Gets the time since when this recommended action is valid. + /// + [JsonProperty(PropertyName = "properties.validSince")] + public System.DateTime? ValidSince { get; private set; } + + /// + /// Gets time when this recommended action was last refreshed. + /// + [JsonProperty(PropertyName = "properties.lastRefresh")] + public System.DateTime? LastRefresh { get; private set; } + + /// + /// Gets the info of the current state the recommended action is in. + /// + [JsonProperty(PropertyName = "properties.state")] + public RecommendedActionStateInfo State { get; set; } + + /// + /// Gets if this recommended action is actionable by user + /// + [JsonProperty(PropertyName = "properties.isExecutableAction")] + public bool? IsExecutableAction { get; private set; } + + /// + /// Gets if changes applied by this recommended action can be reverted + /// by user + /// + [JsonProperty(PropertyName = "properties.isRevertableAction")] + public bool? IsRevertableAction { get; private set; } + + /// + /// Gets if this recommended action was suggested some time ago but + /// user chose to ignore this and system added a new recommended action + /// again. + /// + [JsonProperty(PropertyName = "properties.isArchivedAction")] + public bool? IsArchivedAction { get; private set; } + + /// + /// Gets the time when system started applying this recommended action + /// on the user resource. e.g., index creation start time + /// + [JsonProperty(PropertyName = "properties.executeActionStartTime")] + public System.DateTime? ExecuteActionStartTime { get; private set; } + + /// + /// Gets the time taken for applying this recommended action on user + /// resource. e.g., time taken for index creation + /// + [JsonProperty(PropertyName = "properties.executeActionDuration")] + public string ExecuteActionDuration { get; private set; } + + /// + /// Gets the time when system started reverting changes of this + /// recommended action on user resource. e.g., time when index drop is + /// executed. + /// + [JsonProperty(PropertyName = "properties.revertActionStartTime")] + public System.DateTime? RevertActionStartTime { get; private set; } + + /// + /// Gets the time taken for reverting changes of this recommended + /// action on user resource. e.g., time taken for dropping the created + /// index. + /// + [JsonProperty(PropertyName = "properties.revertActionDuration")] + public string RevertActionDuration { get; private set; } + + /// + /// Gets if approval for applying this recommended action was given by + /// user/system. Possible values include: 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.executeActionInitiatedBy")] + public RecommendedActionInitiatedBy? ExecuteActionInitiatedBy { get; private set; } + + /// + /// Gets the time when this recommended action was approved for + /// execution. + /// + [JsonProperty(PropertyName = "properties.executeActionInitiatedTime")] + public System.DateTime? ExecuteActionInitiatedTime { get; private set; } + + /// + /// Gets if approval for reverting this recommended action was given by + /// user/system. Possible values include: 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.revertActionInitiatedBy")] + public RecommendedActionInitiatedBy? RevertActionInitiatedBy { get; private set; } + + /// + /// Gets the time when this recommended action was approved for revert. + /// + [JsonProperty(PropertyName = "properties.revertActionInitiatedTime")] + public System.DateTime? RevertActionInitiatedTime { get; private set; } + + /// + /// Gets the impact of this recommended action. Possible values are 1 - + /// Low impact, 2 - Medium Impact and 3 - High Impact + /// + [JsonProperty(PropertyName = "properties.score")] + public int? Score { get; private set; } + + /// + /// Gets the implementation details of this recommended action for user + /// to apply it manually. + /// + [JsonProperty(PropertyName = "properties.implementationDetails")] + public RecommendedActionImplementationInfo ImplementationDetails { get; private set; } + + /// + /// Gets the error details if and why this recommended action is put to + /// error state. + /// + [JsonProperty(PropertyName = "properties.errorDetails")] + public RecommendedActionErrorInfo ErrorDetails { get; private set; } + + /// + /// Gets the estimated impact info for this recommended action e.g., + /// Estimated CPU gain, Estimated Disk Space change + /// + [JsonProperty(PropertyName = "properties.estimatedImpact")] + public IList EstimatedImpact { get; private set; } + + /// + /// Gets the observed/actual impact info for this recommended action + /// e.g., Actual CPU gain, Actual Disk Space change + /// + [JsonProperty(PropertyName = "properties.observedImpact")] + public IList ObservedImpact { get; private set; } + + /// + /// Gets the time series info of metrics for this recommended action + /// e.g., CPU consumption time series + /// + [JsonProperty(PropertyName = "properties.timeSeries")] + public IList TimeSeries { get; private set; } + + /// + /// Gets the linked objects, if any. + /// + [JsonProperty(PropertyName = "properties.linkedObjects")] + public IList LinkedObjects { get; private set; } + + /// + /// Gets additional details specific to this recommended action. + /// + [JsonProperty(PropertyName = "properties.details")] + public IDictionary Details { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (State == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "State"); + } + if (State != null) + { + State.Validate(); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs new file mode 100644 index 000000000000..f507c8111eef --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 RecommendedActionCurrentState. + /// + public static class RecommendedActionCurrentState + { + public const string Active = "Active"; + public const string Pending = "Pending"; + public const string Executing = "Executing"; + public const string Verifying = "Verifying"; + public const string PendingRevert = "PendingRevert"; + public const string RevertCancelled = "RevertCancelled"; + public const string Reverting = "Reverting"; + public const string Reverted = "Reverted"; + public const string Ignored = "Ignored"; + public const string Expired = "Expired"; + public const string Monitoring = "Monitoring"; + public const string Resolved = "Resolved"; + public const string Success = "Success"; + public const string Error = "Error"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs new file mode 100644 index 000000000000..6e83bac42f30 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains error information for an Azure SQL Database, Server or Elastic + /// Pool Recommended Action. + /// + public partial class RecommendedActionErrorInfo + { + /// + /// Initializes a new instance of the RecommendedActionErrorInfo class. + /// + public RecommendedActionErrorInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionErrorInfo class. + /// + /// Gets the reason why the recommended action + /// was put to error state. e.g., DatabaseHasQdsOff, + /// IndexAlreadyExists + /// Gets whether the error could be ignored + /// and recommended action could be retried. Possible values are: + /// Yes/No. Possible values include: 'Yes', 'No' + public RecommendedActionErrorInfo(string errorCode = default(string), IsRetryable? isRetryable = default(IsRetryable?)) + { + ErrorCode = errorCode; + IsRetryable = isRetryable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reason why the recommended action was put to error state. + /// e.g., DatabaseHasQdsOff, IndexAlreadyExists + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; private set; } + + /// + /// Gets whether the error could be ignored and recommended action + /// could be retried. Possible values are: Yes/No. Possible values + /// include: 'Yes', 'No' + /// + [JsonProperty(PropertyName = "isRetryable")] + public IsRetryable? IsRetryable { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs new file mode 100644 index 000000000000..f66900e11a92 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information of estimated or observed impact on various metrics + /// for an Azure SQL Database, Server or Elastic Pool Recommended Action. + /// + public partial class RecommendedActionImpactRecord + { + /// + /// Initializes a new instance of the RecommendedActionImpactRecord + /// class. + /// + public RecommendedActionImpactRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionImpactRecord + /// class. + /// + /// Gets the name of the impact dimension. + /// e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + /// Gets the name of the impact dimension. e.g., + /// CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + /// Gets the absolute value of this + /// dimension if applicable. e.g., Number of Queries affected + /// Gets the absolute change in the + /// value of this dimension. e.g., Absolute Disk space change in + /// Megabytes + /// Gets the relative change in the + /// value of this dimension. e.g., Relative Disk space change in + /// Percentage + public RecommendedActionImpactRecord(string dimensionName = default(string), string unit = default(string), double? absoluteValue = default(double?), double? changeValueAbsolute = default(double?), double? changeValueRelative = default(double?)) + { + DimensionName = dimensionName; + Unit = unit; + AbsoluteValue = absoluteValue; + ChangeValueAbsolute = changeValueAbsolute; + ChangeValueRelative = changeValueRelative; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the impact dimension. e.g., CPUChange, + /// DiskSpaceChange, NumberOfQueriesAffected. + /// + [JsonProperty(PropertyName = "dimensionName")] + public string DimensionName { get; private set; } + + /// + /// Gets the name of the impact dimension. e.g., CPUChange, + /// DiskSpaceChange, NumberOfQueriesAffected. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the absolute value of this dimension if applicable. e.g., + /// Number of Queries affected + /// + [JsonProperty(PropertyName = "absoluteValue")] + public double? AbsoluteValue { get; private set; } + + /// + /// Gets the absolute change in the value of this dimension. e.g., + /// Absolute Disk space change in Megabytes + /// + [JsonProperty(PropertyName = "changeValueAbsolute")] + public double? ChangeValueAbsolute { get; private set; } + + /// + /// Gets the relative change in the value of this dimension. e.g., + /// Relative Disk space change in Percentage + /// + [JsonProperty(PropertyName = "changeValueRelative")] + public double? ChangeValueRelative { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs new file mode 100644 index 000000000000..347c90d3e496 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information for manual implementation for an Azure SQL + /// Database, Server or Elastic Pool Recommended Action. + /// + public partial class RecommendedActionImplementationInfo + { + /// + /// Initializes a new instance of the + /// RecommendedActionImplementationInfo class. + /// + public RecommendedActionImplementationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RecommendedActionImplementationInfo class. + /// + /// Gets the method in which this recommended + /// action can be manually implemented. e.g., TSql, AzurePowerShell. + /// Possible values include: 'TSql', 'AzurePowerShell' + /// Gets the manual implementation script. e.g., + /// T-SQL script that could be executed on the database. + public RecommendedActionImplementationInfo(ImplementationMethod? method = default(ImplementationMethod?), string script = default(string)) + { + Method = method; + Script = script; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the method in which this recommended action can be manually + /// implemented. e.g., TSql, AzurePowerShell. Possible values include: + /// 'TSql', 'AzurePowerShell' + /// + [JsonProperty(PropertyName = "method")] + public ImplementationMethod? Method { get; private set; } + + /// + /// Gets the manual implementation script. e.g., T-SQL script that + /// could be executed on the database. + /// + [JsonProperty(PropertyName = "script")] + public string Script { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs new file mode 100644 index 000000000000..79e02aaca4a1 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecommendedActionInitiatedBy. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendedActionInitiatedBy + { + [EnumMember(Value = "User")] + User, + [EnumMember(Value = "System")] + System + } + internal static class RecommendedActionInitiatedByEnumExtension + { + internal static string ToSerializedValue(this RecommendedActionInitiatedBy? value) + { + return value == null ? null : ((RecommendedActionInitiatedBy)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecommendedActionInitiatedBy value) + { + switch( value ) + { + case RecommendedActionInitiatedBy.User: + return "User"; + case RecommendedActionInitiatedBy.System: + return "System"; + } + return null; + } + + internal static RecommendedActionInitiatedBy? ParseRecommendedActionInitiatedBy(this string value) + { + switch( value ) + { + case "User": + return RecommendedActionInitiatedBy.User; + case "System": + return RecommendedActionInitiatedBy.System; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs new file mode 100644 index 000000000000..01dc1b71dbc8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains time series of various impacted metrics for an Azure SQL + /// Database, Server or Elastic Pool Recommended Action. + /// + public partial class RecommendedActionMetricInfo + { + /// + /// Initializes a new instance of the RecommendedActionMetricInfo + /// class. + /// + public RecommendedActionMetricInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionMetricInfo + /// class. + /// + /// Gets the name of the metric. e.g., CPU, + /// Number of Queries. + /// Gets the unit in which metric is measured. e.g., + /// DTU, Frequency + /// Gets the duration of time interval for the + /// value given by this MetricInfo. e.g., PT1H (1 hour) + /// Gets the start time of time interval given + /// by this MetricInfo. + /// Gets the value of the metric in the time + /// interval given by this MetricInfo. + public RecommendedActionMetricInfo(string metricName = default(string), string unit = default(string), string timeGrain = default(string), System.DateTime? startTime = default(System.DateTime?), double? value = default(double?)) + { + MetricName = metricName; + Unit = unit; + TimeGrain = timeGrain; + StartTime = startTime; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the metric. e.g., CPU, Number of Queries. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; private set; } + + /// + /// Gets the unit in which metric is measured. e.g., DTU, Frequency + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the duration of time interval for the value given by this + /// MetricInfo. e.g., PT1H (1 hour) + /// + [JsonProperty(PropertyName = "timeGrain")] + public string TimeGrain { get; private set; } + + /// + /// Gets the start time of time interval given by this MetricInfo. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the value of the metric in the time interval given by this + /// MetricInfo. + /// + [JsonProperty(PropertyName = "value")] + public double? Value { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs new file mode 100644 index 000000000000..28ee87e2af3c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information of current state for an Azure SQL Database, Server + /// or Elastic Pool Recommended Action. + /// + public partial class RecommendedActionStateInfo + { + /// + /// Initializes a new instance of the RecommendedActionStateInfo class. + /// + public RecommendedActionStateInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionStateInfo class. + /// + /// Current state the recommended action is + /// in. Some commonly used states are: Active -> recommended + /// action is active and no action has been taken yet. Pending + /// -> recommended action is approved for and is awaiting execution. + /// Executing -> recommended action is being applied on the user + /// database. Verifying -> recommended action was applied and is + /// being verified of its usefulness by the system. Success -> + /// recommended action was applied and improvement found during + /// verification. Pending Revert -> verification found little or no + /// improvement so recommended action is queued for revert or user has + /// manually reverted. Reverting -> changes made while applying + /// recommended action are being reverted on the user database. + /// Reverted -> successfully reverted the changes made by + /// recommended action on user database. Ignored -> user + /// explicitly ignored/discarded the recommended action. Possible + /// values include: 'Active', 'Pending', 'Executing', 'Verifying', + /// 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', + /// 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', + /// 'Error' + /// Gets who initiated the execution of + /// this recommended action. Possible Value are: User -> When + /// user explicity notified system to apply the recommended action. + /// System -> When auto-execute status of this advisor was set to + /// 'Enabled', in which case the system applied it. Possible values + /// include: 'User', 'System' + /// Gets the time when the state was last + /// modified + public RecommendedActionStateInfo(string currentValue, RecommendedActionInitiatedBy? actionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? lastModified = default(System.DateTime?)) + { + CurrentValue = currentValue; + ActionInitiatedBy = actionInitiatedBy; + LastModified = lastModified; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current state the recommended action is in. Some + /// commonly used states are: Active -> recommended action + /// is active and no action has been taken yet. Pending -> + /// recommended action is approved for and is awaiting execution. + /// Executing -> recommended action is being applied on the + /// user database. Verifying -> recommended action was applied + /// and is being verified of its usefulness by the system. Success + /// -> recommended action was applied and improvement found + /// during verification. Pending Revert -> verification found + /// little or no improvement so recommended action is queued for revert + /// or user has manually reverted. Reverting -> changes made + /// while applying recommended action are being reverted on the user + /// database. Reverted -> successfully reverted the changes + /// made by recommended action on user database. Ignored -> + /// user explicitly ignored/discarded the recommended action. Possible + /// values include: 'Active', 'Pending', 'Executing', 'Verifying', + /// 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', + /// 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error' + /// + [JsonProperty(PropertyName = "currentValue")] + public string CurrentValue { get; set; } + + /// + /// Gets who initiated the execution of this recommended action. + /// Possible Value are: User -> When user explicity notified + /// system to apply the recommended action. System -> When + /// auto-execute status of this advisor was set to 'Enabled', in which + /// case the system applied it. Possible values include: 'User', + /// 'System' + /// + [JsonProperty(PropertyName = "actionInitiatedBy")] + public RecommendedActionInitiatedBy? ActionInitiatedBy { get; private set; } + + /// + /// Gets the time when the state was last modified + /// + [JsonProperty(PropertyName = "lastModified")] + public System.DateTime? LastModified { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CurrentValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CurrentValue"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs deleted file mode 100644 index 64bc89c9d26f..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a recommended elastic pool. - /// - [Rest.Serialization.JsonTransformation] - public partial class RecommendedElasticPool : ProxyResource - { - /// - /// Initializes a new instance of the RecommendedElasticPool class. - /// - public RecommendedElasticPool() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedElasticPool class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The edition of the recommended - /// elastic pool. The ElasticPoolEdition enumeration contains all the - /// valid editions. Possible values include: 'Basic', 'Standard', - /// 'Premium', 'GeneralPurpose', 'BusinessCritical' - /// The DTU for the recommended elastic pool. - /// The minimum DTU for the - /// database. - /// The maximum DTU for the - /// database. - /// Gets storage size in megabytes. - /// The observation period start - /// (ISO8601 format). - /// The observation period start - /// (ISO8601 format). - /// Gets maximum observed DTU. - /// Gets maximum observed storage in - /// megabytes. - /// The list of databases in this pool. - /// Expanded property - /// The list of databases housed in the server. - /// Expanded property - public RecommendedElasticPool(string id = default(string), string name = default(string), string type = default(string), string databaseEdition = default(string), double? dtu = default(double?), double? databaseDtuMin = default(double?), double? databaseDtuMax = default(double?), double? storageMB = default(double?), System.DateTime? observationPeriodStart = default(System.DateTime?), System.DateTime? observationPeriodEnd = default(System.DateTime?), double? maxObservedDtu = default(double?), double? maxObservedStorageMB = default(double?), IList databases = default(IList), IList metrics = default(IList)) - : base(id, name, type) - { - DatabaseEdition = databaseEdition; - Dtu = dtu; - DatabaseDtuMin = databaseDtuMin; - DatabaseDtuMax = databaseDtuMax; - StorageMB = storageMB; - ObservationPeriodStart = observationPeriodStart; - ObservationPeriodEnd = observationPeriodEnd; - MaxObservedDtu = maxObservedDtu; - MaxObservedStorageMB = maxObservedStorageMB; - Databases = databases; - Metrics = metrics; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the edition of the recommended elastic pool. The - /// ElasticPoolEdition enumeration contains all the valid editions. - /// Possible values include: 'Basic', 'Standard', 'Premium', - /// 'GeneralPurpose', 'BusinessCritical' - /// - [JsonProperty(PropertyName = "properties.databaseEdition")] - public string DatabaseEdition { get; private set; } - - /// - /// Gets or sets the DTU for the recommended elastic pool. - /// - [JsonProperty(PropertyName = "properties.dtu")] - public double? Dtu { get; set; } - - /// - /// Gets or sets the minimum DTU for the database. - /// - [JsonProperty(PropertyName = "properties.databaseDtuMin")] - public double? DatabaseDtuMin { get; set; } - - /// - /// Gets or sets the maximum DTU for the database. - /// - [JsonProperty(PropertyName = "properties.databaseDtuMax")] - public double? DatabaseDtuMax { get; set; } - - /// - /// Gets storage size in megabytes. - /// - [JsonProperty(PropertyName = "properties.storageMB")] - public double? StorageMB { get; set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodStart")] - public System.DateTime? ObservationPeriodStart { get; private set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodEnd")] - public System.DateTime? ObservationPeriodEnd { get; private set; } - - /// - /// Gets maximum observed DTU. - /// - [JsonProperty(PropertyName = "properties.maxObservedDtu")] - public double? MaxObservedDtu { get; private set; } - - /// - /// Gets maximum observed storage in megabytes. - /// - [JsonProperty(PropertyName = "properties.maxObservedStorageMB")] - public double? MaxObservedStorageMB { get; private set; } - - /// - /// Gets the list of databases in this pool. Expanded property - /// - [JsonProperty(PropertyName = "properties.databases")] - public IList Databases { get; private set; } - - /// - /// Gets the list of databases housed in the server. Expanded property - /// - [JsonProperty(PropertyName = "properties.metrics")] - public IList Metrics { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs deleted file mode 100644 index b4a124354c27..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents recommended elastic pool metric. - /// - public partial class RecommendedElasticPoolMetric - { - /// - /// Initializes a new instance of the RecommendedElasticPoolMetric - /// class. - /// - public RecommendedElasticPoolMetric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedElasticPoolMetric - /// class. - /// - /// The time of metric (ISO8601 format). - /// Gets or sets the DTUs (Database Transaction - /// Units). See - /// https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - /// Gets or sets size in gigabytes. - public RecommendedElasticPoolMetric(System.DateTime? dateTime = default(System.DateTime?), double? dtu = default(double?), double? sizeGB = default(double?)) - { - DateTime = dateTime; - Dtu = dtu; - SizeGB = sizeGB; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the time of metric (ISO8601 format). - /// - [JsonProperty(PropertyName = "dateTime")] - public System.DateTime? DateTime { get; set; } - - /// - /// Gets or sets the DTUs (Database Transaction Units). See - /// https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - /// - [JsonProperty(PropertyName = "dtu")] - public double? Dtu { get; set; } - - /// - /// Gets or sets size in gigabytes. - /// - [JsonProperty(PropertyName = "sizeGB")] - public double? SizeGB { get; set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs deleted file mode 100644 index 7be471795597..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a database recommended index. - /// - [Rest.Serialization.JsonTransformation] - public partial class RecommendedIndex : ProxyResource - { - /// - /// Initializes a new instance of the RecommendedIndex class. - /// - public RecommendedIndex() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedIndex class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The proposed index action. You can create a - /// missing index, drop an unused index, or rebuild an existing index - /// to improve its performance. Possible values include: 'Create', - /// 'Drop', 'Rebuild' - /// The current recommendation state. Possible - /// values include: 'Active', 'Pending', 'Executing', 'Verifying', - /// 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', - /// 'Blocked', 'Success' - /// The UTC datetime showing when this resource - /// was created (ISO8601 format). - /// The UTC datetime of when was this - /// resource last changed (ISO8601 format). - /// The type of index (CLUSTERED, NONCLUSTERED, - /// COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: - /// 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED - /// COLUMNSTORE' - /// The schema where table to build index over - /// resides - /// The table on which to build index. - /// Columns over which to build index - /// The list of column names to be - /// included in the index - /// The full build index script - /// The estimated impact of doing - /// recommended index action. - /// The values reported after index action - /// is complete. - public RecommendedIndex(string id = default(string), string name = default(string), string type = default(string), RecommendedIndexAction? action = default(RecommendedIndexAction?), RecommendedIndexState? state = default(RecommendedIndexState?), System.DateTime? created = default(System.DateTime?), System.DateTime? lastModified = default(System.DateTime?), RecommendedIndexType? indexType = default(RecommendedIndexType?), string schema = default(string), string table = default(string), IList columns = default(IList), IList includedColumns = default(IList), string indexScript = default(string), IList estimatedImpact = default(IList), IList reportedImpact = default(IList)) - : base(id, name, type) - { - Action = action; - State = state; - Created = created; - LastModified = lastModified; - IndexType = indexType; - Schema = schema; - Table = table; - Columns = columns; - IncludedColumns = includedColumns; - IndexScript = indexScript; - EstimatedImpact = estimatedImpact; - ReportedImpact = reportedImpact; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the proposed index action. You can create a missing index, - /// drop an unused index, or rebuild an existing index to improve its - /// performance. Possible values include: 'Create', 'Drop', 'Rebuild' - /// - [JsonProperty(PropertyName = "properties.action")] - public RecommendedIndexAction? Action { get; private set; } - - /// - /// Gets the current recommendation state. Possible values include: - /// 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', - /// 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' - /// - [JsonProperty(PropertyName = "properties.state")] - public RecommendedIndexState? State { get; private set; } - - /// - /// Gets the UTC datetime showing when this resource was created - /// (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.created")] - public System.DateTime? Created { get; private set; } - - /// - /// Gets the UTC datetime of when was this resource last changed - /// (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.lastModified")] - public System.DateTime? LastModified { get; private set; } - - /// - /// Gets the type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, - /// CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', - /// 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE' - /// - [JsonProperty(PropertyName = "properties.indexType")] - public RecommendedIndexType? IndexType { get; private set; } - - /// - /// Gets the schema where table to build index over resides - /// - [JsonProperty(PropertyName = "properties.schema")] - public string Schema { get; private set; } - - /// - /// Gets the table on which to build index. - /// - [JsonProperty(PropertyName = "properties.table")] - public string Table { get; private set; } - - /// - /// Gets columns over which to build index - /// - [JsonProperty(PropertyName = "properties.columns")] - public IList Columns { get; private set; } - - /// - /// Gets the list of column names to be included in the index - /// - [JsonProperty(PropertyName = "properties.includedColumns")] - public IList IncludedColumns { get; private set; } - - /// - /// Gets the full build index script - /// - [JsonProperty(PropertyName = "properties.indexScript")] - public string IndexScript { get; private set; } - - /// - /// Gets the estimated impact of doing recommended index action. - /// - [JsonProperty(PropertyName = "properties.estimatedImpact")] - public IList EstimatedImpact { get; private set; } - - /// - /// Gets the values reported after index action is complete. - /// - [JsonProperty(PropertyName = "properties.reportedImpact")] - public IList ReportedImpact { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs deleted file mode 100644 index f9f90228c098..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexAction. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexAction - { - [EnumMember(Value = "Create")] - Create, - [EnumMember(Value = "Drop")] - Drop, - [EnumMember(Value = "Rebuild")] - Rebuild - } - internal static class RecommendedIndexActionEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexAction? value) - { - return value == null ? null : ((RecommendedIndexAction)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexAction value) - { - switch( value ) - { - case RecommendedIndexAction.Create: - return "Create"; - case RecommendedIndexAction.Drop: - return "Drop"; - case RecommendedIndexAction.Rebuild: - return "Rebuild"; - } - return null; - } - - internal static RecommendedIndexAction? ParseRecommendedIndexAction(this string value) - { - switch( value ) - { - case "Create": - return RecommendedIndexAction.Create; - case "Drop": - return RecommendedIndexAction.Drop; - case "Rebuild": - return RecommendedIndexAction.Rebuild; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs deleted file mode 100644 index 528724aa2357..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexState. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexState - { - [EnumMember(Value = "Active")] - Active, - [EnumMember(Value = "Pending")] - Pending, - [EnumMember(Value = "Executing")] - Executing, - [EnumMember(Value = "Verifying")] - Verifying, - [EnumMember(Value = "Pending Revert")] - PendingRevert, - [EnumMember(Value = "Reverting")] - Reverting, - [EnumMember(Value = "Reverted")] - Reverted, - [EnumMember(Value = "Ignored")] - Ignored, - [EnumMember(Value = "Expired")] - Expired, - [EnumMember(Value = "Blocked")] - Blocked, - [EnumMember(Value = "Success")] - Success - } - internal static class RecommendedIndexStateEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexState? value) - { - return value == null ? null : ((RecommendedIndexState)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexState value) - { - switch( value ) - { - case RecommendedIndexState.Active: - return "Active"; - case RecommendedIndexState.Pending: - return "Pending"; - case RecommendedIndexState.Executing: - return "Executing"; - case RecommendedIndexState.Verifying: - return "Verifying"; - case RecommendedIndexState.PendingRevert: - return "Pending Revert"; - case RecommendedIndexState.Reverting: - return "Reverting"; - case RecommendedIndexState.Reverted: - return "Reverted"; - case RecommendedIndexState.Ignored: - return "Ignored"; - case RecommendedIndexState.Expired: - return "Expired"; - case RecommendedIndexState.Blocked: - return "Blocked"; - case RecommendedIndexState.Success: - return "Success"; - } - return null; - } - - internal static RecommendedIndexState? ParseRecommendedIndexState(this string value) - { - switch( value ) - { - case "Active": - return RecommendedIndexState.Active; - case "Pending": - return RecommendedIndexState.Pending; - case "Executing": - return RecommendedIndexState.Executing; - case "Verifying": - return RecommendedIndexState.Verifying; - case "Pending Revert": - return RecommendedIndexState.PendingRevert; - case "Reverting": - return RecommendedIndexState.Reverting; - case "Reverted": - return RecommendedIndexState.Reverted; - case "Ignored": - return RecommendedIndexState.Ignored; - case "Expired": - return RecommendedIndexState.Expired; - case "Blocked": - return RecommendedIndexState.Blocked; - case "Success": - return RecommendedIndexState.Success; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs deleted file mode 100644 index a84c416068ec..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexType - { - [EnumMember(Value = "CLUSTERED")] - CLUSTERED, - [EnumMember(Value = "NONCLUSTERED")] - NONCLUSTERED, - [EnumMember(Value = "COLUMNSTORE")] - COLUMNSTORE, - [EnumMember(Value = "CLUSTERED COLUMNSTORE")] - CLUSTEREDCOLUMNSTORE - } - internal static class RecommendedIndexTypeEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexType? value) - { - return value == null ? null : ((RecommendedIndexType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexType value) - { - switch( value ) - { - case RecommendedIndexType.CLUSTERED: - return "CLUSTERED"; - case RecommendedIndexType.NONCLUSTERED: - return "NONCLUSTERED"; - case RecommendedIndexType.COLUMNSTORE: - return "COLUMNSTORE"; - case RecommendedIndexType.CLUSTEREDCOLUMNSTORE: - return "CLUSTERED COLUMNSTORE"; - } - return null; - } - - internal static RecommendedIndexType? ParseRecommendedIndexType(this string value) - { - switch( value ) - { - case "CLUSTERED": - return RecommendedIndexType.CLUSTERED; - case "NONCLUSTERED": - return RecommendedIndexType.NONCLUSTERED; - case "COLUMNSTORE": - return RecommendedIndexType.COLUMNSTORE; - case "CLUSTERED COLUMNSTORE": - return RecommendedIndexType.CLUSTEREDCOLUMNSTORE; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs new file mode 100644 index 000000000000..aabd6bd617a2 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recommended sensitivity label update operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class RecommendedSensitivityLabelUpdate : ProxyResource + { + /// + /// Initializes a new instance of the RecommendedSensitivityLabelUpdate + /// class. + /// + public RecommendedSensitivityLabelUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedSensitivityLabelUpdate + /// class. + /// + /// Possible values include: 'enable', + /// 'disable' + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + /// Resource ID. + /// Resource name. + /// Resource type. + public RecommendedSensitivityLabelUpdate(RecommendedSensitivityLabelUpdateKind op, string schema, string table, string column, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'enable', 'disable' + /// + [JsonProperty(PropertyName = "properties.op")] + public RecommendedSensitivityLabelUpdateKind Op { get; set; } + + /// + /// Gets or sets schema name of the column to update. + /// + [JsonProperty(PropertyName = "properties.schema")] + public string Schema { get; set; } + + /// + /// Gets or sets table name of the column to update. + /// + [JsonProperty(PropertyName = "properties.table")] + public string Table { get; set; } + + /// + /// Gets or sets column name to update. + /// + [JsonProperty(PropertyName = "properties.column")] + public string Column { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Table == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); + } + if (Column == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Column"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs new file mode 100644 index 000000000000..37527d6b8706 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecommendedSensitivityLabelUpdateKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendedSensitivityLabelUpdateKind + { + [EnumMember(Value = "enable")] + Enable, + [EnumMember(Value = "disable")] + Disable + } + internal static class RecommendedSensitivityLabelUpdateKindEnumExtension + { + internal static string ToSerializedValue(this RecommendedSensitivityLabelUpdateKind? value) + { + return value == null ? null : ((RecommendedSensitivityLabelUpdateKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecommendedSensitivityLabelUpdateKind value) + { + switch( value ) + { + case RecommendedSensitivityLabelUpdateKind.Enable: + return "enable"; + case RecommendedSensitivityLabelUpdateKind.Disable: + return "disable"; + } + return null; + } + + internal static RecommendedSensitivityLabelUpdateKind? ParseRecommendedSensitivityLabelUpdateKind(this string value) + { + switch( value ) + { + case "enable": + return RecommendedSensitivityLabelUpdateKind.Enable; + case "disable": + return RecommendedSensitivityLabelUpdateKind.Disable; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Name.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs similarity index 52% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Name.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs index a020564ede68..cabe652110eb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Name.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs @@ -11,30 +11,31 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// ARM Usage Name + /// A list of recommended sensitivity label update operations. /// - public partial class Name + public partial class RecommendedSensitivityLabelUpdateList { /// - /// Initializes a new instance of the Name class. + /// Initializes a new instance of the + /// RecommendedSensitivityLabelUpdateList class. /// - public Name() + public RecommendedSensitivityLabelUpdateList() { CustomInit(); } /// - /// Initializes a new instance of the Name class. + /// Initializes a new instance of the + /// RecommendedSensitivityLabelUpdateList class. /// - /// Usage name value - /// Usage name localized value. - public Name(string value = default(string), string localizedValue = default(string)) + public RecommendedSensitivityLabelUpdateList(IList operations = default(IList)) { - Value = value; - LocalizedValue = localizedValue; + Operations = operations; CustomInit(); } @@ -44,16 +45,9 @@ public Name() partial void CustomInit(); /// - /// Gets or sets usage name value /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets usage name localized value. - /// - [JsonProperty(PropertyName = "localizedValue")] - public string LocalizedValue { get; set; } + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecoverableDatabase.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecoverableDatabase.cs deleted file mode 100644 index cff72abc8bd1..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecoverableDatabase.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A recoverable database - /// - [Rest.Serialization.JsonTransformation] - public partial class RecoverableDatabase : ProxyResource - { - /// - /// Initializes a new instance of the RecoverableDatabase class. - /// - public RecoverableDatabase() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecoverableDatabase class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The edition of the database - /// The service level objective - /// name of the database - /// The elastic pool name of the - /// database - /// The last available backup - /// date of the database (ISO8601 format) - public RecoverableDatabase(string id = default(string), string name = default(string), string type = default(string), string edition = default(string), string serviceLevelObjective = default(string), string elasticPoolName = default(string), System.DateTime? lastAvailableBackupDate = default(System.DateTime?)) - : base(id, name, type) - { - Edition = edition; - ServiceLevelObjective = serviceLevelObjective; - ElasticPoolName = elasticPoolName; - LastAvailableBackupDate = lastAvailableBackupDate; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the edition of the database - /// - [JsonProperty(PropertyName = "properties.edition")] - public string Edition { get; private set; } - - /// - /// Gets the service level objective name of the database - /// - [JsonProperty(PropertyName = "properties.serviceLevelObjective")] - public string ServiceLevelObjective { get; private set; } - - /// - /// Gets the elastic pool name of the database - /// - [JsonProperty(PropertyName = "properties.elasticPoolName")] - public string ElasticPoolName { get; private set; } - - /// - /// Gets the last available backup date of the database (ISO8601 - /// format) - /// - [JsonProperty(PropertyName = "properties.lastAvailableBackupDate")] - public System.DateTime? LastAvailableBackupDate { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationLink.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationLink.cs index 0d886828bfad..915f12daee23 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationLink.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationLink.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents a database replication link. + /// A replication link. /// [Rest.Serialization.JsonTransformation] public partial class ReplicationLink : ProxyResource @@ -35,45 +35,34 @@ public ReplicationLink() /// Resource ID. /// Resource name. /// Resource type. - /// Location of the server that contains this - /// firewall rule. - /// Legacy value indicating whether - /// termination is allowed. Currently always returns true. - /// Replication mode of this replication + /// Resource partner server. + /// Resource partner database. + /// Resource partner location. + /// Local replication role. + /// Partner replication role. + /// Replication mode. + /// Time at which the link was created. + /// Seeding completion percentage for the /// link. - /// The name of the server hosting the - /// partner database. - /// The name of the partner - /// database. - /// The Azure Region of the partner - /// database. - /// The role of the database in the replication - /// link. Possible values include: 'Primary', 'Secondary', - /// 'NonReadableSecondary', 'Source', 'Copy' - /// The role of the partner database in the - /// replication link. Possible values include: 'Primary', 'Secondary', - /// 'NonReadableSecondary', 'Source', 'Copy' - /// The start time for the replication - /// link. - /// The percentage of seeding complete - /// for the replication link. - /// The replication state for the - /// replication link. Possible values include: 'PENDING', 'SEEDING', - /// 'CATCH_UP', 'SUSPENDED' - public ReplicationLink(string id = default(string), string name = default(string), string type = default(string), string location = default(string), bool? isTerminationAllowed = default(bool?), string replicationMode = default(string), string partnerServer = default(string), string partnerDatabase = default(string), string partnerLocation = default(string), ReplicationRole? role = default(ReplicationRole?), ReplicationRole? partnerRole = default(ReplicationRole?), System.DateTime? startTime = default(System.DateTime?), int? percentComplete = default(int?), string replicationState = default(string)) + /// Replication state (PENDING, SEEDING, + /// CATCHUP, SUSPENDED). + /// Whether the user is currently + /// allowed to terminate the link. + /// Link type (GEO, NAMED). + public ReplicationLink(string id = default(string), string name = default(string), string type = default(string), string partnerServer = default(string), string partnerDatabase = default(string), string partnerLocation = default(string), string role = default(string), string partnerRole = default(string), string replicationMode = default(string), System.DateTime? startTime = default(System.DateTime?), int? percentComplete = default(int?), string replicationState = default(string), bool? isTerminationAllowed = default(bool?), string linkType = default(string)) : base(id, name, type) { - Location = location; - IsTerminationAllowed = isTerminationAllowed; - ReplicationMode = replicationMode; PartnerServer = partnerServer; PartnerDatabase = partnerDatabase; PartnerLocation = partnerLocation; Role = role; PartnerRole = partnerRole; + ReplicationMode = replicationMode; StartTime = startTime; PercentComplete = percentComplete; ReplicationState = replicationState; + IsTerminationAllowed = isTerminationAllowed; + LinkType = linkType; CustomInit(); } @@ -83,76 +72,70 @@ public ReplicationLink() partial void CustomInit(); /// - /// Gets location of the server that contains this firewall rule. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets legacy value indicating whether termination is allowed. - /// Currently always returns true. - /// - [JsonProperty(PropertyName = "properties.isTerminationAllowed")] - public bool? IsTerminationAllowed { get; private set; } - - /// - /// Gets replication mode of this replication link. - /// - [JsonProperty(PropertyName = "properties.replicationMode")] - public string ReplicationMode { get; private set; } - - /// - /// Gets the name of the server hosting the partner database. + /// Gets resource partner server. /// [JsonProperty(PropertyName = "properties.partnerServer")] public string PartnerServer { get; private set; } /// - /// Gets the name of the partner database. + /// Gets resource partner database. /// [JsonProperty(PropertyName = "properties.partnerDatabase")] public string PartnerDatabase { get; private set; } /// - /// Gets the Azure Region of the partner database. + /// Gets resource partner location. /// [JsonProperty(PropertyName = "properties.partnerLocation")] public string PartnerLocation { get; private set; } /// - /// Gets the role of the database in the replication link. Possible - /// values include: 'Primary', 'Secondary', 'NonReadableSecondary', - /// 'Source', 'Copy' + /// Gets local replication role. /// [JsonProperty(PropertyName = "properties.role")] - public ReplicationRole? Role { get; private set; } + public string Role { get; private set; } /// - /// Gets the role of the partner database in the replication link. - /// Possible values include: 'Primary', 'Secondary', - /// 'NonReadableSecondary', 'Source', 'Copy' + /// Gets partner replication role. /// [JsonProperty(PropertyName = "properties.partnerRole")] - public ReplicationRole? PartnerRole { get; private set; } + public string PartnerRole { get; private set; } + + /// + /// Gets replication mode. + /// + [JsonProperty(PropertyName = "properties.replicationMode")] + public string ReplicationMode { get; private set; } /// - /// Gets the start time for the replication link. + /// Gets time at which the link was created. /// [JsonProperty(PropertyName = "properties.startTime")] public System.DateTime? StartTime { get; private set; } /// - /// Gets the percentage of seeding complete for the replication link. + /// Gets seeding completion percentage for the link. /// [JsonProperty(PropertyName = "properties.percentComplete")] public int? PercentComplete { get; private set; } /// - /// Gets the replication state for the replication link. Possible - /// values include: 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED' + /// Gets replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). /// [JsonProperty(PropertyName = "properties.replicationState")] public string ReplicationState { get; private set; } + /// + /// Gets whether the user is currently allowed to terminate the link. + /// + [JsonProperty(PropertyName = "properties.isTerminationAllowed")] + public bool? IsTerminationAllowed { get; private set; } + + /// + /// Gets link type (GEO, NAMED). + /// + [JsonProperty(PropertyName = "properties.linkType")] + public string LinkType { get; private set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationRole.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationRole.cs deleted file mode 100644 index f0d74d3f85fb..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationRole.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ReplicationRole. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ReplicationRole - { - [EnumMember(Value = "Primary")] - Primary, - [EnumMember(Value = "Secondary")] - Secondary, - [EnumMember(Value = "NonReadableSecondary")] - NonReadableSecondary, - [EnumMember(Value = "Source")] - Source, - [EnumMember(Value = "Copy")] - Copy - } - internal static class ReplicationRoleEnumExtension - { - internal static string ToSerializedValue(this ReplicationRole? value) - { - return value == null ? null : ((ReplicationRole)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ReplicationRole value) - { - switch( value ) - { - case ReplicationRole.Primary: - return "Primary"; - case ReplicationRole.Secondary: - return "Secondary"; - case ReplicationRole.NonReadableSecondary: - return "NonReadableSecondary"; - case ReplicationRole.Source: - return "Source"; - case ReplicationRole.Copy: - return "Copy"; - } - return null; - } - - internal static ReplicationRole? ParseReplicationRole(this string value) - { - switch( value ) - { - case "Primary": - return ReplicationRole.Primary; - case "Secondary": - return ReplicationRole.Secondary; - case "NonReadableSecondary": - return ReplicationRole.NonReadableSecondary; - case "Source": - return ReplicationRole.Source; - case "Copy": - return ReplicationRole.Copy; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs similarity index 66% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs index 2e1034bc6ebb..6df0be98d2ba 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs @@ -11,24 +11,30 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// Azure Active Directory identity configuration for a resource. /// - public partial class ResourceIdentity + public partial class ResourceIdentityWithUserAssignedIdentities { /// - /// Initializes a new instance of the ResourceIdentity class. + /// Initializes a new instance of the + /// ResourceIdentityWithUserAssignedIdentities class. /// - public ResourceIdentity() + public ResourceIdentityWithUserAssignedIdentities() { CustomInit(); } /// - /// Initializes a new instance of the ResourceIdentity class. + /// Initializes a new instance of the + /// ResourceIdentityWithUserAssignedIdentities class. /// + /// The resource ids of the user + /// assigned identities to use /// The Azure Active Directory principal /// id. /// The identity type. Set this to 'SystemAssigned' @@ -37,8 +43,9 @@ public ResourceIdentity() /// 'None', 'SystemAssigned', 'UserAssigned' /// The Azure Active Directory tenant /// id. - public ResourceIdentity(System.Guid? principalId = default(System.Guid?), string type = default(string), System.Guid? tenantId = default(System.Guid?)) + public ResourceIdentityWithUserAssignedIdentities(IDictionary userAssignedIdentities = default(IDictionary), System.Guid? principalId = default(System.Guid?), string type = default(string), System.Guid? tenantId = default(System.Guid?)) { + UserAssignedIdentities = userAssignedIdentities; PrincipalId = principalId; Type = type; TenantId = tenantId; @@ -50,6 +57,13 @@ public ResourceIdentity() /// partial void CustomInit(); + /// + /// Gets or sets the resource ids of the user assigned identities to + /// use + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + /// /// Gets the Azure Active Directory principal id. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs new file mode 100644 index 000000000000..7b89bf85ef92 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ARM resource. + /// + public partial class ResourceWithWritableName : IResource + { + /// + /// Initializes a new instance of the ResourceWithWritableName class. + /// + public ResourceWithWritableName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceWithWritableName class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public ResourceWithWritableName(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs index 58e9491e62c7..e7d0890219d8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs @@ -13,10 +13,12 @@ namespace Microsoft.Azure.Management.Sql.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// A restorable dropped database + /// A restorable dropped database resource. /// [Rest.Serialization.JsonTransformation] public partial class RestorableDroppedDatabase : ProxyResource @@ -35,31 +37,29 @@ public RestorableDroppedDatabase() /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource - /// lives - /// The name of the database - /// The edition of the database - /// The max size in bytes of the - /// database - /// The service level objective - /// name of the database - /// The elastic pool name of the - /// database + /// The name and tier of the SKU. + /// Resource location. + /// Resource tags. + /// The name of the database. + /// The max size of the database expressed + /// in bytes. + /// The resource name of the elastic pool + /// containing this database. /// The creation date of the database - /// (ISO8601 format) + /// (ISO8601 format). /// The deletion date of the database - /// (ISO8601 format) + /// (ISO8601 format). /// The earliest restore date of the - /// database (ISO8601 format) - public RestorableDroppedDatabase(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string databaseName = default(string), string edition = default(string), string maxSizeBytes = default(string), string serviceLevelObjective = default(string), string elasticPoolName = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? earliestRestoreDate = default(System.DateTime?)) + /// database (ISO8601 format). + public RestorableDroppedDatabase(string id = default(string), string name = default(string), string type = default(string), Sku sku = default(Sku), string location = default(string), IDictionary tags = default(IDictionary), string databaseName = default(string), long? maxSizeBytes = default(long?), string elasticPoolId = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? earliestRestoreDate = default(System.DateTime?)) : base(id, name, type) { + Sku = sku; Location = location; + Tags = tags; DatabaseName = databaseName; - Edition = edition; MaxSizeBytes = maxSizeBytes; - ServiceLevelObjective = serviceLevelObjective; - ElasticPoolName = elasticPoolName; + ElasticPoolId = elasticPoolId; CreationDate = creationDate; DeletionDate = deletionDate; EarliestRestoreDate = earliestRestoreDate; @@ -72,58 +72,72 @@ public RestorableDroppedDatabase() partial void CustomInit(); /// - /// Gets the geo-location where the resource lives + /// Gets or sets the name and tier of the SKU. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } /// - /// Gets the name of the database + /// Gets or sets resource location. /// - [JsonProperty(PropertyName = "properties.databaseName")] - public string DatabaseName { get; private set; } + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } /// - /// Gets the edition of the database + /// Gets or sets resource tags. /// - [JsonProperty(PropertyName = "properties.edition")] - public string Edition { get; private set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } /// - /// Gets the max size in bytes of the database + /// Gets the name of the database. /// - [JsonProperty(PropertyName = "properties.maxSizeBytes")] - public string MaxSizeBytes { get; private set; } + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } /// - /// Gets the service level objective name of the database + /// Gets the max size of the database expressed in bytes. /// - [JsonProperty(PropertyName = "properties.serviceLevelObjective")] - public string ServiceLevelObjective { get; private set; } + [JsonProperty(PropertyName = "properties.maxSizeBytes")] + public long? MaxSizeBytes { get; private set; } /// - /// Gets the elastic pool name of the database + /// Gets the resource name of the elastic pool containing this + /// database. /// - [JsonProperty(PropertyName = "properties.elasticPoolName")] - public string ElasticPoolName { get; private set; } + [JsonProperty(PropertyName = "properties.elasticPoolId")] + public string ElasticPoolId { get; private set; } /// - /// Gets the creation date of the database (ISO8601 format) + /// Gets the creation date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.creationDate")] public System.DateTime? CreationDate { get; private set; } /// - /// Gets the deletion date of the database (ISO8601 format) + /// Gets the deletion date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.deletionDate")] public System.DateTime? DeletionDate { get; private set; } /// - /// Gets the earliest restore date of the database (ISO8601 format) + /// Gets the earliest restore date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.earliestRestoreDate")] public System.DateTime? EarliestRestoreDate { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs deleted file mode 100644 index 0b697a00547d..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for SecurityAlertPolicyEmailAccountAdmins. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum SecurityAlertPolicyEmailAccountAdmins - { - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled - } - internal static class SecurityAlertPolicyEmailAccountAdminsEnumExtension - { - internal static string ToSerializedValue(this SecurityAlertPolicyEmailAccountAdmins? value) - { - return value == null ? null : ((SecurityAlertPolicyEmailAccountAdmins)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this SecurityAlertPolicyEmailAccountAdmins value) - { - switch( value ) - { - case SecurityAlertPolicyEmailAccountAdmins.Enabled: - return "Enabled"; - case SecurityAlertPolicyEmailAccountAdmins.Disabled: - return "Disabled"; - } - return null; - } - - internal static SecurityAlertPolicyEmailAccountAdmins? ParseSecurityAlertPolicyEmailAccountAdmins(this string value) - { - switch( value ) - { - case "Enabled": - return SecurityAlertPolicyEmailAccountAdmins.Enabled; - case "Disabled": - return SecurityAlertPolicyEmailAccountAdmins.Disabled; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs similarity index 62% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs index f825a9f75249..9fd3e2742b7a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs @@ -16,43 +16,43 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for SecurityAlertPolicyUseServerDefault. + /// Defines values for SecurityAlertsPolicyState. /// [JsonConverter(typeof(StringEnumConverter))] - public enum SecurityAlertPolicyUseServerDefault + public enum SecurityAlertsPolicyState { [EnumMember(Value = "Enabled")] Enabled, [EnumMember(Value = "Disabled")] Disabled } - internal static class SecurityAlertPolicyUseServerDefaultEnumExtension + internal static class SecurityAlertsPolicyStateEnumExtension { - internal static string ToSerializedValue(this SecurityAlertPolicyUseServerDefault? value) + internal static string ToSerializedValue(this SecurityAlertsPolicyState? value) { - return value == null ? null : ((SecurityAlertPolicyUseServerDefault)value).ToSerializedValue(); + return value == null ? null : ((SecurityAlertsPolicyState)value).ToSerializedValue(); } - internal static string ToSerializedValue(this SecurityAlertPolicyUseServerDefault value) + internal static string ToSerializedValue(this SecurityAlertsPolicyState value) { switch( value ) { - case SecurityAlertPolicyUseServerDefault.Enabled: + case SecurityAlertsPolicyState.Enabled: return "Enabled"; - case SecurityAlertPolicyUseServerDefault.Disabled: + case SecurityAlertsPolicyState.Disabled: return "Disabled"; } return null; } - internal static SecurityAlertPolicyUseServerDefault? ParseSecurityAlertPolicyUseServerDefault(this string value) + internal static SecurityAlertsPolicyState? ParseSecurityAlertsPolicyState(this string value) { switch( value ) { case "Enabled": - return SecurityAlertPolicyUseServerDefault.Enabled; + return SecurityAlertsPolicyState.Enabled; case "Disabled": - return SecurityAlertPolicyUseServerDefault.Disabled; + return SecurityAlertsPolicyState.Disabled; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs new file mode 100644 index 000000000000..798243420bda --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A security event. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecurityEvent : ProxyResource + { + /// + /// Initializes a new instance of the SecurityEvent class. + /// + public SecurityEvent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityEvent class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time when the security event + /// occurred. + /// The type of the security event. + /// Possible values include: 'Undefined', 'SqlInjectionVulnerability', + /// 'SqlInjectionExploit' + /// The subscription name + /// The server name + /// The database name + /// The IP address of the client who executed + /// the statement. + /// The application used to execute the + /// statement. + /// The principal user who executed the + /// statement + /// The sql + /// injection additional properties, populated only if the type of the + /// security event is sql injection. + public SecurityEvent(string id = default(string), string name = default(string), string type = default(string), System.DateTime? eventTime = default(System.DateTime?), SecurityEventType? securityEventType = default(SecurityEventType?), string subscription = default(string), string server = default(string), string database = default(string), string clientIp = default(string), string applicationName = default(string), string principalName = default(string), SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties = default(SecurityEventSqlInjectionAdditionalProperties)) + : base(id, name, type) + { + EventTime = eventTime; + SecurityEventType = securityEventType; + Subscription = subscription; + Server = server; + Database = database; + ClientIp = clientIp; + ApplicationName = applicationName; + PrincipalName = principalName; + SecurityEventSqlInjectionAdditionalProperties = securityEventSqlInjectionAdditionalProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time when the security event occurred. + /// + [JsonProperty(PropertyName = "properties.eventTime")] + public System.DateTime? EventTime { get; private set; } + + /// + /// Gets the type of the security event. Possible values include: + /// 'Undefined', 'SqlInjectionVulnerability', 'SqlInjectionExploit' + /// + [JsonProperty(PropertyName = "properties.securityEventType")] + public SecurityEventType? SecurityEventType { get; private set; } + + /// + /// Gets the subscription name + /// + [JsonProperty(PropertyName = "properties.subscription")] + public string Subscription { get; private set; } + + /// + /// Gets the server name + /// + [JsonProperty(PropertyName = "properties.server")] + public string Server { get; private set; } + + /// + /// Gets the database name + /// + [JsonProperty(PropertyName = "properties.database")] + public string Database { get; private set; } + + /// + /// Gets the IP address of the client who executed the statement. + /// + [JsonProperty(PropertyName = "properties.clientIp")] + public string ClientIp { get; private set; } + + /// + /// Gets the application used to execute the statement. + /// + [JsonProperty(PropertyName = "properties.applicationName")] + public string ApplicationName { get; private set; } + + /// + /// Gets the principal user who executed the statement + /// + [JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets the sql injection additional properties, populated only if the + /// type of the security event is sql injection. + /// + [JsonProperty(PropertyName = "properties.securityEventSqlInjectionAdditionalProperties")] + public SecurityEventSqlInjectionAdditionalProperties SecurityEventSqlInjectionAdditionalProperties { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs new file mode 100644 index 000000000000..af9e3fc6ffdc --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a security event sql injection additional properties. + /// + public partial class SecurityEventSqlInjectionAdditionalProperties + { + /// + /// Initializes a new instance of the + /// SecurityEventSqlInjectionAdditionalProperties class. + /// + public SecurityEventSqlInjectionAdditionalProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SecurityEventSqlInjectionAdditionalProperties class. + /// + /// The threat ID. + /// The statement + /// The statement highlight + /// offset + /// The statement highlight + /// length + /// The sql error code + /// The sql error severity + /// The sql error message + public SecurityEventSqlInjectionAdditionalProperties(string threatId = default(string), string statement = default(string), int? statementHighlightOffset = default(int?), int? statementHighlightLength = default(int?), int? errorCode = default(int?), int? errorSeverity = default(int?), string errorMessage = default(string)) + { + ThreatId = threatId; + Statement = statement; + StatementHighlightOffset = statementHighlightOffset; + StatementHighlightLength = statementHighlightLength; + ErrorCode = errorCode; + ErrorSeverity = errorSeverity; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the threat ID. + /// + [JsonProperty(PropertyName = "threatId")] + public string ThreatId { get; private set; } + + /// + /// Gets the statement + /// + [JsonProperty(PropertyName = "statement")] + public string Statement { get; private set; } + + /// + /// Gets the statement highlight offset + /// + [JsonProperty(PropertyName = "statementHighlightOffset")] + public int? StatementHighlightOffset { get; private set; } + + /// + /// Gets the statement highlight length + /// + [JsonProperty(PropertyName = "statementHighlightLength")] + public int? StatementHighlightLength { get; private set; } + + /// + /// Gets the sql error code + /// + [JsonProperty(PropertyName = "errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets the sql error severity + /// + [JsonProperty(PropertyName = "errorSeverity")] + public int? ErrorSeverity { get; private set; } + + /// + /// Gets the sql error message + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs new file mode 100644 index 000000000000..ab86fe79be12 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SecurityEventType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SecurityEventType + { + [EnumMember(Value = "Undefined")] + Undefined, + [EnumMember(Value = "SqlInjectionVulnerability")] + SqlInjectionVulnerability, + [EnumMember(Value = "SqlInjectionExploit")] + SqlInjectionExploit + } + internal static class SecurityEventTypeEnumExtension + { + internal static string ToSerializedValue(this SecurityEventType? value) + { + return value == null ? null : ((SecurityEventType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SecurityEventType value) + { + switch( value ) + { + case SecurityEventType.Undefined: + return "Undefined"; + case SecurityEventType.SqlInjectionVulnerability: + return "SqlInjectionVulnerability"; + case SecurityEventType.SqlInjectionExploit: + return "SqlInjectionExploit"; + } + return null; + } + + internal static SecurityEventType? ParseSecurityEventType(this string value) + { + switch( value ) + { + case "Undefined": + return SecurityEventType.Undefined; + case "SqlInjectionVulnerability": + return SecurityEventType.SqlInjectionVulnerability; + case "SqlInjectionExploit": + return SecurityEventType.SqlInjectionExploit; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs new file mode 100644 index 000000000000..db623e849951 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties that are supported in the $filter operation. + /// + public partial class SecurityEventsFilterParameters + { + /// + /// Initializes a new instance of the SecurityEventsFilterParameters + /// class. + /// + public SecurityEventsFilterParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityEventsFilterParameters + /// class. + /// + /// Filter on the event time. + /// Whether to show server records or + /// not. + public SecurityEventsFilterParameters(System.DateTime? eventTime = default(System.DateTime?), bool? showServerRecords = default(bool?)) + { + EventTime = eventTime; + ShowServerRecords = showServerRecords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets filter on the event time. + /// + [JsonProperty(PropertyName = "eventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets whether to show server records or not. + /// + [JsonProperty(PropertyName = "showServerRecords")] + public bool? ShowServerRecords { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs index 7ca8f24fa570..1eb4054312c5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs @@ -35,6 +35,11 @@ public SensitivityLabel() /// Resource ID. /// Resource name. /// Resource type. + /// Resource that manages the sensitivity + /// label. + /// The schema name. + /// The table name. + /// The column name. /// The label name. /// The label ID. /// The information type. @@ -45,9 +50,13 @@ public SensitivityLabel() /// (dismissed) or not. /// Possible values include: 'None', 'Low', /// 'Medium', 'High', 'Critical' - public SensitivityLabel(string id = default(string), string name = default(string), string type = default(string), string labelName = default(string), string labelId = default(string), string informationType = default(string), string informationTypeId = default(string), bool? isDisabled = default(bool?), SensitivityLabelRank? rank = default(SensitivityLabelRank?)) + public SensitivityLabel(string id = default(string), string name = default(string), string type = default(string), string managedBy = default(string), string schemaName = default(string), string tableName = default(string), string columnName = default(string), string labelName = default(string), string labelId = default(string), string informationType = default(string), string informationTypeId = default(string), bool? isDisabled = default(bool?), SensitivityLabelRank? rank = default(SensitivityLabelRank?)) : base(id, name, type) { + ManagedBy = managedBy; + SchemaName = schemaName; + TableName = tableName; + ColumnName = columnName; LabelName = labelName; LabelId = labelId; InformationType = informationType; @@ -62,6 +71,30 @@ public SensitivityLabel() /// partial void CustomInit(); + /// + /// Gets resource that manages the sensitivity label. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// Gets the schema name. + /// + [JsonProperty(PropertyName = "properties.schemaName")] + public string SchemaName { get; private set; } + + /// + /// Gets the table name. + /// + [JsonProperty(PropertyName = "properties.tableName")] + public string TableName { get; private set; } + + /// + /// Gets the column name. + /// + [JsonProperty(PropertyName = "properties.columnName")] + public string ColumnName { get; private set; } + /// /// Gets or sets the label name. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs new file mode 100644 index 000000000000..dd11c8713b59 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs @@ -0,0 +1,113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A sensitivity label update operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class SensitivityLabelUpdate : ProxyResource + { + /// + /// Initializes a new instance of the SensitivityLabelUpdate class. + /// + public SensitivityLabelUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabelUpdate class. + /// + /// Possible values include: 'set', 'remove' + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The sensitivity label information to + /// apply on a column. + public SensitivityLabelUpdate(SensitivityLabelUpdateKind op, string schema, string table, string column, string id = default(string), string name = default(string), string type = default(string), SensitivityLabel sensitivityLabel = default(SensitivityLabel)) + : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + SensitivityLabel = sensitivityLabel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'set', 'remove' + /// + [JsonProperty(PropertyName = "properties.op")] + public SensitivityLabelUpdateKind Op { get; set; } + + /// + /// Gets or sets schema name of the column to update. + /// + [JsonProperty(PropertyName = "properties.schema")] + public string Schema { get; set; } + + /// + /// Gets or sets table name of the column to update. + /// + [JsonProperty(PropertyName = "properties.table")] + public string Table { get; set; } + + /// + /// Gets or sets column name to update. + /// + [JsonProperty(PropertyName = "properties.column")] + public string Column { get; set; } + + /// + /// Gets or sets the sensitivity label information to apply on a + /// column. + /// + [JsonProperty(PropertyName = "properties.sensitivityLabel")] + public SensitivityLabel SensitivityLabel { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Table == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); + } + if (Column == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Column"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs new file mode 100644 index 000000000000..f450732de127 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SensitivityLabelUpdateKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SensitivityLabelUpdateKind + { + [EnumMember(Value = "set")] + Set, + [EnumMember(Value = "remove")] + Remove + } + internal static class SensitivityLabelUpdateKindEnumExtension + { + internal static string ToSerializedValue(this SensitivityLabelUpdateKind? value) + { + return value == null ? null : ((SensitivityLabelUpdateKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SensitivityLabelUpdateKind value) + { + switch( value ) + { + case SensitivityLabelUpdateKind.Set: + return "set"; + case SensitivityLabelUpdateKind.Remove: + return "remove"; + } + return null; + } + + internal static SensitivityLabelUpdateKind? ParseSensitivityLabelUpdateKind(this string value) + { + switch( value ) + { + case "set": + return SensitivityLabelUpdateKind.Set; + case "remove": + return SensitivityLabelUpdateKind.Remove; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs new file mode 100644 index 000000000000..ab075881b1e9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of sensitivity label update operations. + /// + public partial class SensitivityLabelUpdateList + { + /// + /// Initializes a new instance of the SensitivityLabelUpdateList class. + /// + public SensitivityLabelUpdateList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabelUpdateList class. + /// + public SensitivityLabelUpdateList(IList operations = default(IList)) + { + Operations = operations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs index ceb028f78c6f..ab0d88976156 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs @@ -59,7 +59,20 @@ public Server() /// access is allowed for this server. Value is optional but if passed /// in, must be 'Enabled' or 'Disabled'. Possible values include: /// 'Enabled', 'Disabled' - public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string)) + /// Whether or not existing server has a + /// workspace created and if it allows connection from workspace. + /// Possible values include: 'Connected', 'Disconnected' + /// The resource id of a + /// user assigned identity to be used by default. + /// A CMK URI of the key to use for + /// encryption. + /// The Azure Active Directory identity of + /// the server. + /// Whether or not to + /// restrict outbound network access for this server. Value is + /// optional but if passed in, must be 'Enabled' or 'Disabled'. + /// Possible values include: 'Enabled', 'Disabled' + public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string kind = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string workspaceFeature = default(string), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ServerExternalAdministrator administrators = default(ServerExternalAdministrator), string restrictOutboundNetworkAccess = default(string)) : base(location, id, name, type, tags) { Identity = identity; @@ -72,6 +85,11 @@ public Server() PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; PublicNetworkAccess = publicNetworkAccess; + WorkspaceFeature = workspaceFeature; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; + RestrictOutboundNetworkAccess = restrictOutboundNetworkAccess; CustomInit(); } @@ -84,7 +102,7 @@ public Server() /// Gets or sets the Azure Active Directory identity of the server. /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets kind of sql server. This is metadata used for the Azure portal @@ -146,6 +164,41 @@ public Server() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public string PublicNetworkAccess { get; set; } + /// + /// Gets whether or not existing server has a workspace created and if + /// it allows connection from workspace. Possible values include: + /// 'Connected', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.workspaceFeature")] + public string WorkspaceFeature { get; private set; } + + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ServerExternalAdministrator Administrators { get; set; } + + /// + /// Gets or sets whether or not to restrict outbound network access for + /// this server. Value is optional but if passed in, must be 'Enabled' + /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.restrictOutboundNetworkAccess")] + public string RestrictOutboundNetworkAccess { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs index ff252b229b69..5b3f8efae406 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs @@ -34,30 +34,32 @@ public ServerBlobAuditingPolicy() /// /// Initializes a new instance of the ServerBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// Specifies the blob storage endpoint - /// (e.g. https://MyAccount.blob.core.windows.net). If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is - /// required. - /// Specifies the identifier key - /// of the auditing storage account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Specifies the state of devops + /// audit. If state is Enabled, devops logs will be sent to Azure + /// Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// Specifies the number of days to keep in /// the audit logs in the storage account. /// Specifies the Actions-Groups @@ -134,15 +136,13 @@ public ServerBlobAuditingPolicy() /// /// For more information, see [Database-Level Audit /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) - /// Specifies the blob - /// storage subscription Id. /// Specifies whether /// storageAccountAccessKey value is the storage's secondary /// key. /// Specifies whether audit /// events are sent to Azure Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -164,18 +164,39 @@ public ServerBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + /// required. + /// Specifies the identifier key + /// of the auditing storage account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Specifies the blob + /// storage subscription Id. + public ServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), bool? isDevopsAuditEnabled = default(bool?), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; + IsDevopsAuditEnabled = isDevopsAuditEnabled; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; CustomInit(); } @@ -185,39 +206,28 @@ public ServerBlobAuditingPolicy() partial void CustomInit(); /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// Gets or sets specifies the state of devops audit. If state is + /// Enabled, devops logs will be sent to Azure Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } + [JsonProperty(PropertyName = "properties.isDevopsAuditEnabled")] + public bool? IsDevopsAuditEnabled { get; set; } /// /// Gets or sets specifies the number of days to keep in the audit logs @@ -305,12 +315,6 @@ public ServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -321,8 +325,8 @@ public ServerBlobAuditingPolicy() /// /// Gets or sets specifies whether audit events are sent to Azure /// Monitor. - /// In order to send the events to Azure Monitor, specify 'state' as - /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -352,6 +356,47 @@ public ServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerCommunicationLink.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerCommunicationLink.cs deleted file mode 100644 index 487917094d84..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerCommunicationLink.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Server communication link. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerCommunicationLink : ProxyResource - { - /// - /// Initializes a new instance of the ServerCommunicationLink class. - /// - public ServerCommunicationLink() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerCommunicationLink class. - /// - /// The name of the partner server. - /// Resource ID. - /// Resource name. - /// Resource type. - /// The state. - /// Communication link location. - /// Communication link kind. This property is used - /// for Azure Portal metadata. - public ServerCommunicationLink(string partnerServer, string id = default(string), string name = default(string), string type = default(string), string state = default(string), string location = default(string), string kind = default(string)) - : base(id, name, type) - { - State = state; - PartnerServer = partnerServer; - Location = location; - Kind = kind; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the state. - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; private set; } - - /// - /// Gets or sets the name of the partner server. - /// - [JsonProperty(PropertyName = "properties.partnerServer")] - public string PartnerServer { get; set; } - - /// - /// Gets communication link location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets communication link kind. This property is used for Azure - /// Portal metadata. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PartnerServer == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PartnerServer"); - } - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionPolicy.cs deleted file mode 100644 index 3e71ad3d28b3..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionPolicy.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A server secure connection policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerConnectionPolicy : ProxyResource - { - /// - /// Initializes a new instance of the ServerConnectionPolicy class. - /// - public ServerConnectionPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerConnectionPolicy class. - /// - /// The server connection type. Possible - /// values include: 'Default', 'Proxy', 'Redirect' - /// Resource ID. - /// Resource name. - /// Resource type. - /// Metadata used for the Azure portal - /// experience. - /// Resource location. - public ServerConnectionPolicy(ServerConnectionType connectionType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string)) - : base(id, name, type) - { - Kind = kind; - Location = location; - ConnectionType = connectionType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets metadata used for the Azure portal experience. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Gets resource location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets the server connection type. Possible values include: - /// 'Default', 'Proxy', 'Redirect' - /// - [JsonProperty(PropertyName = "properties.connectionType")] - public ServerConnectionType ConnectionType { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionType.cs deleted file mode 100644 index ad0ffc408e10..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerConnectionType.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ServerConnectionType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ServerConnectionType - { - [EnumMember(Value = "Default")] - Default, - [EnumMember(Value = "Proxy")] - Proxy, - [EnumMember(Value = "Redirect")] - Redirect - } - internal static class ServerConnectionTypeEnumExtension - { - internal static string ToSerializedValue(this ServerConnectionType? value) - { - return value == null ? null : ((ServerConnectionType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ServerConnectionType value) - { - switch( value ) - { - case ServerConnectionType.Default: - return "Default"; - case ServerConnectionType.Proxy: - return "Proxy"; - case ServerConnectionType.Redirect: - return "Redirect"; - } - return null; - } - - internal static ServerConnectionType? ParseServerConnectionType(this string value) - { - switch( value ) - { - case "Default": - return ServerConnectionType.Default; - case "Proxy": - return ServerConnectionType.Proxy; - case "Redirect": - return ServerConnectionType.Redirect; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs index 4b63f09d11e2..3ed770d4b0b2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs @@ -10,11 +10,12 @@ namespace Microsoft.Azure.Management.Sql.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// A server DNS alias acquisition request. + /// A server dns alias acquisition request. /// public partial class ServerDnsAliasAcquisition { @@ -31,7 +32,7 @@ public ServerDnsAliasAcquisition() /// /// The id of the server alias that /// will be acquired to point to this server instead. - public ServerDnsAliasAcquisition(string oldServerDnsAliasId = default(string)) + public ServerDnsAliasAcquisition(string oldServerDnsAliasId) { OldServerDnsAliasId = oldServerDnsAliasId; CustomInit(); @@ -49,5 +50,18 @@ public ServerDnsAliasAcquisition() [JsonProperty(PropertyName = "oldServerDnsAliasId")] public string OldServerDnsAliasId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OldServerDnsAliasId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OldServerDnsAliasId"); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs new file mode 100644 index 000000000000..8c8c94543a63 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a active directory administrator. + /// + public partial class ServerExternalAdministrator + { + /// + /// Initializes a new instance of the ServerExternalAdministrator + /// class. + /// + public ServerExternalAdministrator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerExternalAdministrator + /// class. + /// + /// Type of the sever administrator. + /// Possible values include: 'ActiveDirectory' + /// Principal Type of the sever + /// administrator. Possible values include: 'User', 'Group', + /// 'Application' + /// Login name of the server administrator. + /// SID (object ID) of the server + /// administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only + /// Authentication enabled. + public ServerExternalAdministrator(string administratorType = default(string), string principalType = default(string), string login = default(string), System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), bool? azureADOnlyAuthentication = default(bool?)) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the sever administrator. Possible values + /// include: 'ActiveDirectory' + /// + [JsonProperty(PropertyName = "administratorType")] + public string AdministratorType { get; set; } + + /// + /// Gets or sets principal Type of the sever administrator. Possible + /// values include: 'User', 'Group', 'Application' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets login name of the server administrator. + /// + [JsonProperty(PropertyName = "login")] + public string Login { get; set; } + + /// + /// Gets or sets SID (object ID) of the server administrator. + /// + [JsonProperty(PropertyName = "sid")] + public System.Guid? Sid { get; set; } + + /// + /// Gets or sets tenant ID of the administrator. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets azure Active Directory only Authentication enabled. + /// + [JsonProperty(PropertyName = "azureADOnlyAuthentication")] + public bool? AzureADOnlyAuthentication { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs index 75567c92ac7e..d343d862e29f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs @@ -42,10 +42,13 @@ public ServerKey() /// used for the Azure portal experience. /// Resource location. /// Subregion of the server key. - /// The URI of the server key. + /// The URI of the server key. If the ServerKeyType + /// is AzureKeyVault, then the URI is required. /// Thumbprint of the server key. /// The server key creation date. - public ServerKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ServerKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -55,6 +58,7 @@ public ServerKey() Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -64,11 +68,11 @@ public ServerKey() partial void CustomInit(); /// - /// Gets or sets kind of encryption protector. This is metadata used - /// for the Azure portal experience. + /// Gets kind of encryption protector. This is metadata used for the + /// Azure portal experience. /// [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } + public string Kind { get; private set; } /// /// Gets resource location. @@ -91,22 +95,29 @@ public ServerKey() public string ServerKeyType { get; set; } /// - /// Gets or sets the URI of the server key. + /// Gets or sets the URI of the server key. If the ServerKeyType is + /// AzureKeyVault, then the URI is required. /// [JsonProperty(PropertyName = "properties.uri")] public string Uri { get; set; } /// - /// Gets or sets thumbprint of the server key. + /// Gets thumbprint of the server key. /// [JsonProperty(PropertyName = "properties.thumbprint")] - public string Thumbprint { get; set; } + public string Thumbprint { get; private set; } /// - /// Gets or sets the server key creation date. + /// Gets the server key creation date. /// [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; set; } + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; private set; } /// /// Validate the object. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs similarity index 84% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs index 6b611e0db6a3..d7c9fb5f6c51 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for ServerPublicNetworkAccess. + /// Defines values for ServerNetworkAccessFlag. /// - public static class ServerPublicNetworkAccess + public static class ServerNetworkAccessFlag { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs new file mode 100644 index 000000000000..fe17244072e8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs @@ -0,0 +1,164 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A server operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServerOperation : ProxyResource + { + /// + /// Initializes a new instance of the ServerOperation class. + /// + public ServerOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerOperation class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The name of operation. + /// The friendly name of + /// operation. + /// The percentage of the operation + /// completed. + /// The name of the server. + /// The operation start time. + /// The operation state. Possible values include: + /// 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// The operation error code. + /// The operation error + /// description. + /// The operation error severity. + /// Whether or not the error is a user + /// error. + /// The estimated completion time + /// of the operation. + /// The operation description. + /// Whether the operation can be + /// cancelled. + public ServerOperation(string id = default(string), string name = default(string), string type = default(string), string operation = default(string), string operationFriendlyName = default(string), int? percentComplete = default(int?), string serverName = default(string), System.DateTime? startTime = default(System.DateTime?), string state = default(string), int? errorCode = default(int?), string errorDescription = default(string), int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTime? estimatedCompletionTime = default(System.DateTime?), string description = default(string), bool? isCancellable = default(bool?)) + : base(id, name, type) + { + Operation = operation; + OperationFriendlyName = operationFriendlyName; + PercentComplete = percentComplete; + ServerName = serverName; + StartTime = startTime; + State = state; + ErrorCode = errorCode; + ErrorDescription = errorDescription; + ErrorSeverity = errorSeverity; + IsUserError = isUserError; + EstimatedCompletionTime = estimatedCompletionTime; + Description = description; + IsCancellable = isCancellable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of operation. + /// + [JsonProperty(PropertyName = "properties.operation")] + public string Operation { get; private set; } + + /// + /// Gets the friendly name of operation. + /// + [JsonProperty(PropertyName = "properties.operationFriendlyName")] + public string OperationFriendlyName { get; private set; } + + /// + /// Gets the percentage of the operation completed. + /// + [JsonProperty(PropertyName = "properties.percentComplete")] + public int? PercentComplete { get; private set; } + + /// + /// Gets the name of the server. + /// + [JsonProperty(PropertyName = "properties.serverName")] + public string ServerName { get; private set; } + + /// + /// Gets the operation start time. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the operation state. Possible values include: 'Pending', + /// 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets the operation error code. + /// + [JsonProperty(PropertyName = "properties.errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets the operation error description. + /// + [JsonProperty(PropertyName = "properties.errorDescription")] + public string ErrorDescription { get; private set; } + + /// + /// Gets the operation error severity. + /// + [JsonProperty(PropertyName = "properties.errorSeverity")] + public int? ErrorSeverity { get; private set; } + + /// + /// Gets whether or not the error is a user error. + /// + [JsonProperty(PropertyName = "properties.isUserError")] + public bool? IsUserError { get; private set; } + + /// + /// Gets the estimated completion time of the operation. + /// + [JsonProperty(PropertyName = "properties.estimatedCompletionTime")] + public System.DateTime? EstimatedCompletionTime { get; private set; } + + /// + /// Gets the operation description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets whether the operation can be cancelled. + /// + [JsonProperty(PropertyName = "properties.isCancellable")] + public bool? IsCancellable { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs index c931ffdac9c7..f9a14d06a646 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs @@ -36,15 +36,17 @@ public ServerSecurityAlertPolicy() /// /// Specifies the state of the policy, whether it /// is enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', + /// specific database. Possible values include: 'Enabled', /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of + /// SecurityAlertPolicyResource. /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -58,9 +60,10 @@ public ServerSecurityAlertPolicy() /// the Threat Detection audit logs. /// Specifies the UTC creation time of the /// policy. - public ServerSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) + public ServerSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -77,19 +80,24 @@ public ServerSecurityAlertPolicy() /// partial void CustomInit(); + /// + /// Gets systemData of SecurityAlertPolicyResource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Gets or sets specifies the state of the policy, whether it is /// enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', - /// 'Disabled' + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs index cd86344ea902..4b5da3a0a2f5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs @@ -34,6 +34,7 @@ public ServerUpdate() /// /// Initializes a new instance of the ServerUpdate class. /// + /// Server identity /// Administrator username for the /// server. Once created it cannot be changed. /// The administrator login @@ -50,9 +51,23 @@ public ServerUpdate() /// access is allowed for this server. Value is optional but if passed /// in, must be 'Enabled' or 'Disabled'. Possible values include: /// 'Enabled', 'Disabled' + /// Whether or not existing server has a + /// workspace created and if it allows connection from workspace. + /// Possible values include: 'Connected', 'Disconnected' + /// The resource id of a + /// user assigned identity to be used by default. + /// A CMK URI of the key to use for + /// encryption. + /// The Azure Active Directory identity of + /// the server. + /// Whether or not to + /// restrict outbound network access for this server. Value is + /// optional but if passed in, must be 'Enabled' or 'Disabled'. + /// Possible values include: 'Enabled', 'Disabled' /// Resource tags. - public ServerUpdate(string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), IDictionary tags = default(IDictionary)) + public ServerUpdate(ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string workspaceFeature = default(string), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ServerExternalAdministrator administrators = default(ServerExternalAdministrator), string restrictOutboundNetworkAccess = default(string), IDictionary tags = default(IDictionary)) { + Identity = identity; AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; Version = version; @@ -61,6 +76,11 @@ public ServerUpdate() PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; PublicNetworkAccess = publicNetworkAccess; + WorkspaceFeature = workspaceFeature; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; + RestrictOutboundNetworkAccess = restrictOutboundNetworkAccess; Tags = tags; CustomInit(); } @@ -70,6 +90,12 @@ public ServerUpdate() /// partial void CustomInit(); + /// + /// Gets or sets server identity + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } + /// /// Gets or sets administrator username for the server. Once created it /// cannot be changed. @@ -123,6 +149,41 @@ public ServerUpdate() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public string PublicNetworkAccess { get; set; } + /// + /// Gets whether or not existing server has a workspace created and if + /// it allows connection from workspace. Possible values include: + /// 'Connected', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.workspaceFeature")] + public string WorkspaceFeature { get; private set; } + + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ServerExternalAdministrator Administrators { get; set; } + + /// + /// Gets or sets whether or not to restrict outbound network access for + /// this server. Value is optional but if passed in, must be 'Enabled' + /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.restrictOutboundNetworkAccess")] + public string RestrictOutboundNetworkAccess { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUsage.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUsage.cs deleted file mode 100644 index ccac9aadc55e..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUsage.cs +++ /dev/null @@ -1,100 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents server metrics. - /// - public partial class ServerUsage - { - /// - /// Initializes a new instance of the ServerUsage class. - /// - public ServerUsage() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerUsage class. - /// - /// Name of the server usage metric. - /// The name of the resource. - /// The metric display name. - /// The current value of the metric. - /// The current limit of the metric. - /// The units of the metric. - /// The next reset time for the metric - /// (ISO8601 format). - public ServerUsage(string name = default(string), string resourceName = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string), System.DateTime? nextResetTime = default(System.DateTime?)) - { - Name = name; - ResourceName = resourceName; - DisplayName = displayName; - CurrentValue = currentValue; - Limit = limit; - Unit = unit; - NextResetTime = nextResetTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets name of the server usage metric. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the name of the resource. - /// - [JsonProperty(PropertyName = "resourceName")] - public string ResourceName { get; private set; } - - /// - /// Gets the metric display name. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; private set; } - - /// - /// Gets the current value of the metric. - /// - [JsonProperty(PropertyName = "currentValue")] - public double? CurrentValue { get; private set; } - - /// - /// Gets the current limit of the metric. - /// - [JsonProperty(PropertyName = "limit")] - public double? Limit { get; private set; } - - /// - /// Gets the units of the metric. - /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; private set; } - - /// - /// Gets the next reset time for the metric (ISO8601 format). - /// - [JsonProperty(PropertyName = "nextResetTime")] - public System.DateTime? NextResetTime { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs index 0fe8baa64ded..a66171057791 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs @@ -41,8 +41,8 @@ public ServerVulnerabilityAssessment() /// Resource name. /// Resource type. /// A shared access signature (SAS - /// Key) that has read and write access to the blob container specified - /// in 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// Key) that has write access to the blob container specified in + /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' /// isn't specified, StorageContainerSasKey is required. /// Specifies the identifier key /// of the storage account for vulnerability assessment scan results. @@ -72,10 +72,10 @@ public ServerVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets a shared access signature (SAS Key) that has read and - /// write access to the blob container specified in - /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' - /// isn't specified, StorageContainerSasKey is required. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs new file mode 100644 index 000000000000..568b5b9b66f3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.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 ServerWorkspaceFeature. + /// + public static class ServerWorkspaceFeature + { + public const string Connected = "Connected"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjective.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjective.cs deleted file mode 100644 index b8c2a93d2027..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjective.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a database service objective. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServiceObjective : ProxyResource - { - /// - /// Initializes a new instance of the ServiceObjective class. - /// - public ServiceObjective() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServiceObjective class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The name for the service - /// objective. - /// Gets whether the service level objective is - /// the default service objective. - /// Gets whether the service level objective is - /// a system service objective. - /// The description for the service level - /// objective. - /// Gets whether the service level objective is - /// enabled. - public ServiceObjective(string id = default(string), string name = default(string), string type = default(string), string serviceObjectiveName = default(string), bool isDefault = default(bool), bool isSystem = default(bool), string description = default(string), bool enabled = default(bool)) - : base(id, name, type) - { - ServiceObjectiveName = serviceObjectiveName; - IsDefault = isDefault; - IsSystem = isSystem; - Description = description; - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the name for the service objective. - /// - [JsonProperty(PropertyName = "properties.serviceObjectiveName")] - public string ServiceObjectiveName { get; private set; } - - /// - /// Gets whether the service level objective is the default service - /// objective. - /// - [JsonProperty(PropertyName = "properties.isDefault")] - public bool IsDefault { get; private set; } - - /// - /// Gets whether the service level objective is a system service - /// objective. - /// - [JsonProperty(PropertyName = "properties.isSystem")] - public bool IsSystem { get; private set; } - - /// - /// Gets the description for the service level objective. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets whether the service level objective is enabled. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjectiveName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjectiveName.cs deleted file mode 100644 index befe17ba9bbf..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceObjectiveName.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for ServiceObjectiveName. - /// - public static class ServiceObjectiveName - { - public const string System = "System"; - public const string System0 = "System0"; - public const string System1 = "System1"; - public const string System2 = "System2"; - public const string System3 = "System3"; - public const string System4 = "System4"; - public const string System2L = "System2L"; - public const string System3L = "System3L"; - public const string System4L = "System4L"; - public const string Free = "Free"; - public const string Basic = "Basic"; - public const string S0 = "S0"; - public const string S1 = "S1"; - public const string S2 = "S2"; - public const string S3 = "S3"; - public const string S4 = "S4"; - public const string S6 = "S6"; - public const string S7 = "S7"; - public const string S9 = "S9"; - public const string S12 = "S12"; - public const string P1 = "P1"; - public const string P2 = "P2"; - public const string P3 = "P3"; - public const string P4 = "P4"; - public const string P6 = "P6"; - public const string P11 = "P11"; - public const string P15 = "P15"; - public const string PRS1 = "PRS1"; - public const string PRS2 = "PRS2"; - public const string PRS4 = "PRS4"; - public const string PRS6 = "PRS6"; - public const string DW100 = "DW100"; - public const string DW200 = "DW200"; - public const string DW300 = "DW300"; - public const string DW400 = "DW400"; - public const string DW500 = "DW500"; - public const string DW600 = "DW600"; - public const string DW1000 = "DW1000"; - public const string DW1200 = "DW1200"; - public const string DW1000c = "DW1000c"; - public const string DW1500 = "DW1500"; - public const string DW1500c = "DW1500c"; - public const string DW2000 = "DW2000"; - public const string DW2000c = "DW2000c"; - public const string DW3000 = "DW3000"; - public const string DW2500c = "DW2500c"; - public const string DW3000c = "DW3000c"; - public const string DW6000 = "DW6000"; - public const string DW5000c = "DW5000c"; - public const string DW6000c = "DW6000c"; - public const string DW7500c = "DW7500c"; - public const string DW10000c = "DW10000c"; - public const string DW15000c = "DW15000c"; - public const string DW30000c = "DW30000c"; - public const string DS100 = "DS100"; - public const string DS200 = "DS200"; - public const string DS300 = "DS300"; - public const string DS400 = "DS400"; - public const string DS500 = "DS500"; - public const string DS600 = "DS600"; - public const string DS1000 = "DS1000"; - public const string DS1200 = "DS1200"; - public const string DS1500 = "DS1500"; - public const string DS2000 = "DS2000"; - public const string ElasticPool = "ElasticPool"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs deleted file mode 100644 index 1809b4de6261..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs +++ /dev/null @@ -1,246 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a Service Tier Advisor. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServiceTierAdvisor : ProxyResource - { - /// - /// Initializes a new instance of the ServiceTierAdvisor class. - /// - public ServiceTierAdvisor() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServiceTierAdvisor class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The observation period start - /// (ISO8601 format). - /// The observation period start - /// (ISO8601 format). - /// The activeTimeRatio for service tier - /// advisor. - /// Gets or sets minDtu for service tier - /// advisor. - /// Gets or sets avgDtu for service tier - /// advisor. - /// Gets or sets maxDtu for service tier - /// advisor. - /// Gets or sets maxSizeInGB for service tier - /// advisor. - /// Gets or sets - /// serviceLevelObjectiveUsageMetrics for the service tier - /// advisor. - /// Gets or sets - /// currentServiceLevelObjective for service tier advisor. - /// Gets or sets - /// currentServiceLevelObjectiveId for service tier advisor. - /// Gets or - /// sets usageBasedRecommendationServiceLevelObjective for service tier - /// advisor. - /// Gets - /// or sets usageBasedRecommendationServiceLevelObjectiveId for service - /// tier advisor. - /// Gets or - /// sets databaseSizeBasedRecommendationServiceLevelObjective for - /// service tier advisor. - /// Gets - /// or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// Gets or - /// sets disasterPlanBasedRecommendationServiceLevelObjective for - /// service tier advisor. - /// Gets - /// or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// Gets or - /// sets overallRecommendationServiceLevelObjective for service tier - /// advisor. - /// Gets or - /// sets overallRecommendationServiceLevelObjectiveId for service tier - /// advisor. - /// Gets or sets confidence for service tier - /// advisor. - public ServiceTierAdvisor(string id = default(string), string name = default(string), string type = default(string), System.DateTime? observationPeriodStart = default(System.DateTime?), System.DateTime? observationPeriodEnd = default(System.DateTime?), double? activeTimeRatio = default(double?), double? minDtu = default(double?), double? avgDtu = default(double?), double? maxDtu = default(double?), double? maxSizeInGB = default(double?), IList serviceLevelObjectiveUsageMetrics = default(IList), string currentServiceLevelObjective = default(string), System.Guid? currentServiceLevelObjectiveId = default(System.Guid?), string usageBasedRecommendationServiceLevelObjective = default(string), System.Guid? usageBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string databaseSizeBasedRecommendationServiceLevelObjective = default(string), System.Guid? databaseSizeBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string disasterPlanBasedRecommendationServiceLevelObjective = default(string), System.Guid? disasterPlanBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string overallRecommendationServiceLevelObjective = default(string), System.Guid? overallRecommendationServiceLevelObjectiveId = default(System.Guid?), double confidence = default(double)) - : base(id, name, type) - { - ObservationPeriodStart = observationPeriodStart; - ObservationPeriodEnd = observationPeriodEnd; - ActiveTimeRatio = activeTimeRatio; - MinDtu = minDtu; - AvgDtu = avgDtu; - MaxDtu = maxDtu; - MaxSizeInGB = maxSizeInGB; - ServiceLevelObjectiveUsageMetrics = serviceLevelObjectiveUsageMetrics; - CurrentServiceLevelObjective = currentServiceLevelObjective; - CurrentServiceLevelObjectiveId = currentServiceLevelObjectiveId; - UsageBasedRecommendationServiceLevelObjective = usageBasedRecommendationServiceLevelObjective; - UsageBasedRecommendationServiceLevelObjectiveId = usageBasedRecommendationServiceLevelObjectiveId; - DatabaseSizeBasedRecommendationServiceLevelObjective = databaseSizeBasedRecommendationServiceLevelObjective; - DatabaseSizeBasedRecommendationServiceLevelObjectiveId = databaseSizeBasedRecommendationServiceLevelObjectiveId; - DisasterPlanBasedRecommendationServiceLevelObjective = disasterPlanBasedRecommendationServiceLevelObjective; - DisasterPlanBasedRecommendationServiceLevelObjectiveId = disasterPlanBasedRecommendationServiceLevelObjectiveId; - OverallRecommendationServiceLevelObjective = overallRecommendationServiceLevelObjective; - OverallRecommendationServiceLevelObjectiveId = overallRecommendationServiceLevelObjectiveId; - Confidence = confidence; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodStart")] - public System.DateTime? ObservationPeriodStart { get; private set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodEnd")] - public System.DateTime? ObservationPeriodEnd { get; private set; } - - /// - /// Gets the activeTimeRatio for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.activeTimeRatio")] - public double? ActiveTimeRatio { get; private set; } - - /// - /// Gets or sets minDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.minDtu")] - public double? MinDtu { get; private set; } - - /// - /// Gets or sets avgDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.avgDtu")] - public double? AvgDtu { get; private set; } - - /// - /// Gets or sets maxDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.maxDtu")] - public double? MaxDtu { get; private set; } - - /// - /// Gets or sets maxSizeInGB for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.maxSizeInGB")] - public double? MaxSizeInGB { get; private set; } - - /// - /// Gets or sets serviceLevelObjectiveUsageMetrics for the service tier - /// advisor. - /// - [JsonProperty(PropertyName = "properties.serviceLevelObjectiveUsageMetrics")] - public IList ServiceLevelObjectiveUsageMetrics { get; private set; } - - /// - /// Gets or sets currentServiceLevelObjective for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.currentServiceLevelObjective")] - public string CurrentServiceLevelObjective { get; private set; } - - /// - /// Gets or sets currentServiceLevelObjectiveId for service tier - /// advisor. - /// - [JsonProperty(PropertyName = "properties.currentServiceLevelObjectiveId")] - public System.Guid? CurrentServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets usageBasedRecommendationServiceLevelObjective for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.usageBasedRecommendationServiceLevelObjective")] - public string UsageBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets usageBasedRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.usageBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? UsageBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjective - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.databaseSizeBasedRecommendationServiceLevelObjective")] - public string DatabaseSizeBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? DatabaseSizeBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjective - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.disasterPlanBasedRecommendationServiceLevelObjective")] - public string DisasterPlanBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? DisasterPlanBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets overallRecommendationServiceLevelObjective for service - /// tier advisor. - /// - [JsonProperty(PropertyName = "properties.overallRecommendationServiceLevelObjective")] - public string OverallRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets overallRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.overallRecommendationServiceLevelObjectiveId")] - public System.Guid? OverallRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets confidence for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.confidence")] - public double Confidence { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SloUsageMetric.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SloUsageMetric.cs deleted file mode 100644 index 0f4b019f4948..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SloUsageMetric.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A Slo Usage Metric. - /// - public partial class SloUsageMetric - { - /// - /// Initializes a new instance of the SloUsageMetric class. - /// - public SloUsageMetric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SloUsageMetric class. - /// - /// The serviceLevelObjective for - /// SLO usage metric. Possible values include: 'System', 'System0', - /// 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', - /// 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', - /// 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', - /// 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', - /// 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', - /// 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', - /// 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', - /// 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', - /// 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' - /// The serviceLevelObjectiveId - /// for SLO usage metric. - /// Gets or sets inRangeTimeRatio for - /// SLO usage metric. - public SloUsageMetric(string serviceLevelObjective = default(string), System.Guid serviceLevelObjectiveId = default(System.Guid), double inRangeTimeRatio = default(double)) - { - ServiceLevelObjective = serviceLevelObjective; - ServiceLevelObjectiveId = serviceLevelObjectiveId; - InRangeTimeRatio = inRangeTimeRatio; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the serviceLevelObjective for SLO usage metric. Possible - /// values include: 'System', 'System0', 'System1', 'System2', - /// 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', - /// 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', - /// 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', - /// 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', - /// 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', - /// 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', - /// 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', - /// 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', - /// 'DS1500', 'DS2000', 'ElasticPool' - /// - [JsonProperty(PropertyName = "serviceLevelObjective")] - public string ServiceLevelObjective { get; private set; } - - /// - /// Gets the serviceLevelObjectiveId for SLO usage metric. - /// - [JsonProperty(PropertyName = "serviceLevelObjectiveId")] - public System.Guid ServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets inRangeTimeRatio for SLO usage metric. - /// - [JsonProperty(PropertyName = "inRangeTimeRatio")] - public double InRangeTimeRatio { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs new file mode 100644 index 000000000000..e1b4daef7714 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recoverable managed database resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlAgentConfiguration : ProxyResource + { + /// + /// Initializes a new instance of the SqlAgentConfiguration class. + /// + public SqlAgentConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlAgentConfiguration class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of Sql Agent. Possible values + /// include: 'Enabled', 'Disabled' + public SqlAgentConfiguration(string id = default(string), string name = default(string), string type = default(string), string state = default(string)) + : base(id, name, type) + { + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of Sql Agent. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs index ba3c84abd60c..fa9f57608078 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs @@ -35,6 +35,7 @@ public SyncGroup() /// Resource ID. /// Resource name. /// Resource type. + /// The name and capacity of the SKU. /// Sync interval of the sync group. /// Last sync time of the sync /// group. @@ -51,13 +52,18 @@ public SyncGroup() /// values include: 'NotReady', 'Error', 'Warning', 'Progressing', /// 'Good' /// Sync schema of the sync group. + /// If conflict logging is + /// enabled. + /// Conflict logging + /// retention period. /// If use private link /// connection is enabled. /// Private endpoint name of the sync /// group if use private link connection is enabled. - public SyncGroup(string id = default(string), string name = default(string), string type = default(string), int? interval = default(int?), System.DateTime? lastSyncTime = default(System.DateTime?), string conflictResolutionPolicy = default(string), string syncDatabaseId = default(string), string hubDatabaseUserName = default(string), string hubDatabasePassword = default(string), string syncState = default(string), SyncGroupSchema schema = default(SyncGroupSchema), bool? usePrivateLinkConnection = default(bool?), string privateEndpointName = default(string)) + public SyncGroup(string id = default(string), string name = default(string), string type = default(string), Sku sku = default(Sku), int? interval = default(int?), System.DateTime? lastSyncTime = default(System.DateTime?), string conflictResolutionPolicy = default(string), string syncDatabaseId = default(string), string hubDatabaseUserName = default(string), string hubDatabasePassword = default(string), string syncState = default(string), SyncGroupSchema schema = default(SyncGroupSchema), bool? enableConflictLogging = default(bool?), int? conflictLoggingRetentionInDays = default(int?), bool? usePrivateLinkConnection = default(bool?), string privateEndpointName = default(string)) : base(id, name, type) { + Sku = sku; Interval = interval; LastSyncTime = lastSyncTime; ConflictResolutionPolicy = conflictResolutionPolicy; @@ -66,6 +72,8 @@ public SyncGroup() HubDatabasePassword = hubDatabasePassword; SyncState = syncState; Schema = schema; + EnableConflictLogging = enableConflictLogging; + ConflictLoggingRetentionInDays = conflictLoggingRetentionInDays; UsePrivateLinkConnection = usePrivateLinkConnection; PrivateEndpointName = privateEndpointName; CustomInit(); @@ -76,6 +84,12 @@ public SyncGroup() /// partial void CustomInit(); + /// + /// Gets or sets the name and capacity of the SKU. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + /// /// Gets or sets sync interval of the sync group. /// @@ -127,6 +141,18 @@ public SyncGroup() [JsonProperty(PropertyName = "properties.schema")] public SyncGroupSchema Schema { get; set; } + /// + /// Gets or sets if conflict logging is enabled. + /// + [JsonProperty(PropertyName = "properties.enableConflictLogging")] + public bool? EnableConflictLogging { get; set; } + + /// + /// Gets or sets conflict logging retention period. + /// + [JsonProperty(PropertyName = "properties.conflictLoggingRetentionInDays")] + public int? ConflictLoggingRetentionInDays { get; set; } + /// /// Gets or sets if use private link connection is enabled. /// @@ -140,5 +166,18 @@ public SyncGroup() [JsonProperty(PropertyName = "properties.privateEndpointName")] public string PrivateEndpointName { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs index 2c71b27ad8cb..5215a566c46e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs @@ -29,22 +29,20 @@ public SystemData() /// /// Initializes a new instance of the SystemData class. /// - /// A string identifier for the identity that - /// created the resource. + /// The identity that created the + /// resource. /// The type of identity that created the - /// resource: <User|Application|ManagedIdentity|Key>. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', - /// 'Key' + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' /// The timestamp of resource creation /// (UTC). - /// A string identifier for the identity - /// that last modified the resource. + /// The identity that last modified the + /// resource. /// The type of identity that last - /// modified the resource: - /// <User|Application|ManagedIdentity|Key>. Possible values - /// include: 'User', 'Application', 'ManagedIdentity', 'Key' - /// The timestamp of last modification - /// (UTC). + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) { CreatedBy = createdBy; @@ -62,46 +60,44 @@ public SystemData() partial void CustomInit(); /// - /// Gets a string identifier for the identity that created the - /// resource. + /// Gets or sets the identity that created the resource. /// [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; private set; } + public string CreatedBy { get; set; } /// - /// Gets the type of identity that created the resource: - /// &lt;User|Application|ManagedIdentity|Key&gt;. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', 'Key' + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' /// [JsonProperty(PropertyName = "createdByType")] - public string CreatedByType { get; private set; } + public string CreatedByType { get; set; } /// - /// Gets the timestamp of resource creation (UTC). + /// Gets or sets the timestamp of resource creation (UTC). /// [JsonProperty(PropertyName = "createdAt")] - public System.DateTime? CreatedAt { get; private set; } + public System.DateTime? CreatedAt { get; set; } /// - /// Gets a string identifier for the identity that last modified the - /// resource. + /// Gets or sets the identity that last modified the resource. /// [JsonProperty(PropertyName = "lastModifiedBy")] - public string LastModifiedBy { get; private set; } + public string LastModifiedBy { get; set; } /// - /// Gets the type of identity that last modified the resource: - /// &lt;User|Application|ManagedIdentity|Key&gt;. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', 'Key' + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' /// [JsonProperty(PropertyName = "lastModifiedByType")] - public string LastModifiedByType { get; private set; } + public string LastModifiedByType { get; set; } /// - /// Gets the timestamp of last modification (UTC). + /// Gets or sets the timestamp of resource last modification (UTC) /// [JsonProperty(PropertyName = "lastModifiedAt")] - public System.DateTime? LastModifiedAt { get; private set; } + public System.DateTime? LastModifiedAt { get; set; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs index 4ce546476901..471655c7bbfa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs @@ -12,14 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for ElasticPoolEdition. + /// Defines values for TableTemporalType. /// - public static class ElasticPoolEdition + public static class TableTemporalType { - public const string Basic = "Basic"; - public const string Standard = "Standard"; - public const string Premium = "Premium"; - public const string GeneralPurpose = "GeneralPurpose"; - public const string BusinessCritical = "BusinessCritical"; + public const string NonTemporalTable = "NonTemporalTable"; + public const string HistoryTable = "HistoryTable"; + public const string SystemVersionedTemporalTable = "SystemVersionedTemporalTable"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs new file mode 100644 index 000000000000..1151f38a1b73 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Time Zone. + /// + [Rest.Serialization.JsonTransformation] + public partial class TimeZone : ProxyResource + { + /// + /// Initializes a new instance of the TimeZone class. + /// + public TimeZone() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeZone class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time zone id + /// The time zone display name + public TimeZone(string id = default(string), string name = default(string), string type = default(string), string timeZoneId = default(string), string displayName = default(string)) + : base(id, name, type) + { + TimeZoneId = timeZoneId; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time zone id + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; private set; } + + /// + /// Gets the time zone display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs deleted file mode 100644 index ab34253c2b81..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a database transparent data encryption Scan. - /// - [Rest.Serialization.JsonTransformation] - public partial class TransparentDataEncryptionActivity : ProxyResource - { - /// - /// Initializes a new instance of the TransparentDataEncryptionActivity - /// class. - /// - public TransparentDataEncryptionActivity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TransparentDataEncryptionActivity - /// class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource location. - /// The status of the database. Possible values - /// include: 'Encrypting', 'Decrypting' - /// The percent complete of the - /// transparent data encryption scan for a database. - public TransparentDataEncryptionActivity(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string status = default(string), double? percentComplete = default(double?)) - : base(id, name, type) - { - Location = location; - Status = status; - PercentComplete = percentComplete; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the status of the database. Possible values include: - /// 'Encrypting', 'Decrypting' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } - - /// - /// Gets the percent complete of the transparent data encryption scan - /// for a database. - /// - [JsonProperty(PropertyName = "properties.percentComplete")] - public double? PercentComplete { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs similarity index 67% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs index 63f5456de378..65c67a0ddb0b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs @@ -16,43 +16,43 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for TransparentDataEncryptionStatus. + /// Defines values for TransparentDataEncryptionState. /// [JsonConverter(typeof(StringEnumConverter))] - public enum TransparentDataEncryptionStatus + public enum TransparentDataEncryptionState { [EnumMember(Value = "Enabled")] Enabled, [EnumMember(Value = "Disabled")] Disabled } - internal static class TransparentDataEncryptionStatusEnumExtension + internal static class TransparentDataEncryptionStateEnumExtension { - internal static string ToSerializedValue(this TransparentDataEncryptionStatus? value) + internal static string ToSerializedValue(this TransparentDataEncryptionState? value) { - return value == null ? null : ((TransparentDataEncryptionStatus)value).ToSerializedValue(); + return value == null ? null : ((TransparentDataEncryptionState)value).ToSerializedValue(); } - internal static string ToSerializedValue(this TransparentDataEncryptionStatus value) + internal static string ToSerializedValue(this TransparentDataEncryptionState value) { switch( value ) { - case TransparentDataEncryptionStatus.Enabled: + case TransparentDataEncryptionState.Enabled: return "Enabled"; - case TransparentDataEncryptionStatus.Disabled: + case TransparentDataEncryptionState.Disabled: return "Disabled"; } return null; } - internal static TransparentDataEncryptionStatus? ParseTransparentDataEncryptionStatus(this string value) + internal static TransparentDataEncryptionState? ParseTransparentDataEncryptionState(this string value) { switch( value ) { case "Enabled": - return TransparentDataEncryptionStatus.Enabled; + return TransparentDataEncryptionState.Enabled; case "Disabled": - return TransparentDataEncryptionStatus.Disabled; + return TransparentDataEncryptionState.Disabled; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitDefinitionType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitDefinitionType.cs deleted file mode 100644 index 1184776ad156..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitDefinitionType.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for UnitDefinitionType. - /// - public static class UnitDefinitionType - { - public const string Count = "Count"; - public const string Bytes = "Bytes"; - public const string Seconds = "Seconds"; - public const string Percent = "Percent"; - public const string CountPerSecond = "CountPerSecond"; - public const string BytesPerSecond = "BytesPerSecond"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitType.cs deleted file mode 100644 index ecd9b7388bdf..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnitType.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for UnitType. - /// - public static class UnitType - { - public const string Count = "count"; - public const string Bytes = "bytes"; - public const string Seconds = "seconds"; - public const string Percent = "percent"; - public const string CountPerSecond = "countPerSecond"; - public const string BytesPerSecond = "bytesPerSecond"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs new file mode 100644 index 000000000000..159f7fb13fae --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recoverable managed database resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class UpdateManagedInstanceDnsServersOperation : ProxyResource + { + /// + /// Initializes a new instance of the + /// UpdateManagedInstanceDnsServersOperation class. + /// + public UpdateManagedInstanceDnsServersOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpdateManagedInstanceDnsServersOperation class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The status of the DNS refresh operation. + /// Possible values include: 'Succeeded', 'Failed' + public UpdateManagedInstanceDnsServersOperation(string id = default(string), string name = default(string), string type = default(string), string status = default(string)) + : base(id, name, type) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status of the DNS refresh operation. Possible values + /// include: 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Usage.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Usage.cs deleted file mode 100644 index 7895ec71d6b5..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Usage.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// ARM usage. - /// - public partial class Usage - { - /// - /// Initializes a new instance of the Usage class. - /// - public Usage() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Usage class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// Usage unit. - /// Usage current value. - /// Usage limit. - /// Usage requested limit. - public Usage(string id = default(string), Name name = default(Name), string type = default(string), string unit = default(string), int? currentValue = default(int?), int? limit = default(int?), int? requestedLimit = default(int?)) - { - Id = id; - Name = name; - Type = type; - Unit = unit; - CurrentValue = currentValue; - Limit = limit; - RequestedLimit = requestedLimit; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource ID. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name. - /// - [JsonProperty(PropertyName = "name")] - public Name Name { get; private set; } - - /// - /// Gets resource type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets usage unit. - /// - [JsonProperty(PropertyName = "unit")] - public string Unit { get; private set; } - - /// - /// Gets usage current value. - /// - [JsonProperty(PropertyName = "currentValue")] - public int? CurrentValue { get; private set; } - - /// - /// Gets usage limit. - /// - [JsonProperty(PropertyName = "limit")] - public int? Limit { get; private set; } - - /// - /// Gets usage requested limit. - /// - [JsonProperty(PropertyName = "requestedLimit")] - public int? RequestedLimit { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs new file mode 100644 index 000000000000..db5b24d3ce04 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Active Directory identity configuration for a resource. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + /// The Azure Active Directory principal + /// id. + /// The Azure Active Directory client + /// id. + public UserIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Azure Active Directory principal id. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the Azure Active Directory client id. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs index 5b9b536fffc8..755cb297d545 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs @@ -45,12 +45,15 @@ public VirtualCluster() /// hardware, for the same SKU, then that can be captured here. /// List of resources in this virtual /// cluster. - public VirtualCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string subnetId = default(string), string family = default(string), IList childResources = default(IList)) + /// Specifies maintenance + /// configuration id to apply to this virtual cluster. + public VirtualCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string subnetId = default(string), string family = default(string), IList childResources = default(IList), string maintenanceConfigurationId = default(string)) : base(location, id, name, type, tags) { SubnetId = subnetId; Family = family; ChildResources = childResources; + MaintenanceConfigurationId = maintenanceConfigurationId; CustomInit(); } @@ -78,6 +81,13 @@ public VirtualCluster() [JsonProperty(PropertyName = "properties.childResources")] public IList ChildResources { get; private set; } + /// + /// Gets or sets specifies maintenance configuration id to apply to + /// this virtual cluster. + /// + [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] + public string MaintenanceConfigurationId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs index 3bb25968e80f..c2e42f40e32f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs @@ -40,12 +40,15 @@ public VirtualClusterUpdate() /// hardware, for the same SKU, then that can be captured here. /// List of resources in this virtual /// cluster. + /// Specifies maintenance + /// configuration id to apply to this virtual cluster. /// Resource tags. - public VirtualClusterUpdate(string subnetId = default(string), string family = default(string), IList childResources = default(IList), IDictionary tags = default(IDictionary)) + public VirtualClusterUpdate(string subnetId = default(string), string family = default(string), IList childResources = default(IList), string maintenanceConfigurationId = default(string), IDictionary tags = default(IDictionary)) { SubnetId = subnetId; Family = family; ChildResources = childResources; + MaintenanceConfigurationId = maintenanceConfigurationId; Tags = tags; CustomInit(); } @@ -74,6 +77,13 @@ public VirtualClusterUpdate() [JsonProperty(PropertyName = "properties.childResources")] public IList ChildResources { get; private set; } + /// + /// Gets or sets specifies maintenance configuration id to apply to + /// this virtual cluster. + /// + [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] + public string MaintenanceConfigurationId { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs index b34438897190..7ad4863674ce 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs @@ -41,8 +41,8 @@ public VirtualNetworkRule() /// before the virtual network has vnet service endpoint /// enabled. /// Virtual Network Rule State. Possible values - /// include: 'Initializing', 'InProgress', 'Ready', 'Deleting', - /// 'Unknown' + /// include: 'Initializing', 'InProgress', 'Ready', 'Failed', + /// 'Deleting', 'Unknown' public VirtualNetworkRule(string virtualNetworkSubnetId, string id = default(string), string name = default(string), string type = default(string), bool? ignoreMissingVnetServiceEndpoint = default(bool?), string state = default(string)) : base(id, name, type) { @@ -72,7 +72,8 @@ public VirtualNetworkRule() /// /// Gets virtual Network Rule State. Possible values include: - /// 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + /// 'Initializing', 'InProgress', 'Ready', 'Failed', 'Deleting', + /// 'Unknown' /// [JsonProperty(PropertyName = "properties.state")] public string State { get; private set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs index ef0dd2f70a5b..1b0e17f64db1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs @@ -19,6 +19,7 @@ public static class VirtualNetworkRuleState public const string Initializing = "Initializing"; public const string InProgress = "InProgress"; public const string Ready = "Ready"; + public const string Failed = "Failed"; public const string Deleting = "Deleting"; public const string Unknown = "Unknown"; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs index 3880565f9539..17def8e7f6a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs @@ -65,12 +65,21 @@ internal Operations(SqlManagementClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -78,7 +87,6 @@ internal Operations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -86,9 +94,9 @@ internal Operations(SqlManagementClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Sql/operations").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -196,7 +204,7 @@ internal Operations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -369,7 +377,7 @@ internal Operations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs similarity index 73% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs index 0ae12e2249e0..c7a8c7a4289a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceTierAdvisorsOperations operations. + /// OperationsHealthOperations operations. /// - internal partial class ServiceTierAdvisorsOperations : IServiceOperations, IServiceTierAdvisorsOperations + internal partial class OperationsHealthOperations : IServiceOperations, IOperationsHealthOperations { /// - /// Initializes a new instance of the ServiceTierAdvisorsOperations class. + /// Initializes a new instance of the OperationsHealthOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServiceTierAdvisorsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServiceTierAdvisorsOperations(SqlManagementClient client) + internal OperationsHealthOperations(SqlManagementClient client) { if (client == null) { @@ -51,20 +51,10 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a service tier advisor. + /// Gets a service operation health status. /// - /// - /// 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 database. - /// - /// - /// The name of service tier advisor. + /// + /// The name of the region where the resource is located. /// /// /// Headers that will be added to request. @@ -87,29 +77,20 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) + if (locationName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (serviceTierAdvisorName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceTierAdvisorName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -117,26 +98,19 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("serviceTierAdvisorName", serviceTierAdvisorName); + tracingParameters.Add("locationName", locationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _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("{serviceTierAdvisorName}", System.Uri.EscapeDataString(serviceTierAdvisorName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -231,7 +205,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -244,7 +218,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -264,17 +238,10 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) } /// - /// Returns service tier advisors for specified database. + /// Gets a service operation health status. /// - /// - /// 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 database. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -297,25 +264,12 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -323,25 +277,14 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -435,7 +378,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -448,7 +391,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs new file mode 100644 index 000000000000..31d88d56ac98 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationsHealthOperations. + /// + public static partial class OperationsHealthOperationsExtensions + { + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + public static IPage ListByLocation(this IOperationsHealthOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IOperationsHealthOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IOperationsHealthOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IOperationsHealthOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperations.cs new file mode 100644 index 000000000000..cc5ca089841b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperations.cs @@ -0,0 +1,1094 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OutboundFirewallRulesOperations operations. + /// + internal partial class OutboundFirewallRulesOperations : IServiceOperations, IOutboundFirewallRulesOperations + { + /// + /// Initializes a new instance of the OutboundFirewallRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OutboundFirewallRulesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets an outbound firewall rule. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (outboundRuleFqdn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "outboundRuleFqdn"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("outboundRuleFqdn", outboundRuleFqdn); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{outboundRuleFqdn}", System.Uri.EscapeDataString(outboundRuleFqdn)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (outboundRuleFqdn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "outboundRuleFqdn"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + OutboundFirewallRule parameters = new OutboundFirewallRule(); + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("outboundRuleFqdn", outboundRuleFqdn); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{outboundRuleFqdn}", System.Uri.EscapeDataString(outboundRuleFqdn)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (outboundRuleFqdn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "outboundRuleFqdn"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("outboundRuleFqdn", outboundRuleFqdn); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{outboundRuleFqdn}", System.Uri.EscapeDataString(outboundRuleFqdn)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperationsExtensions.cs new file mode 100644 index 000000000000..9ab612fc066c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperationsExtensions.cs @@ -0,0 +1,325 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OutboundFirewallRulesOperations. + /// + public static partial class OutboundFirewallRulesOperationsExtensions + { + /// + /// Gets an outbound firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + public static OutboundFirewallRule Get(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn) + { + return operations.GetAsync(resourceGroupName, serverName, outboundRuleFqdn).GetAwaiter().GetResult(); + } + + /// + /// Gets an outbound firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + public static OutboundFirewallRule CreateOrUpdate(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn).GetAwaiter().GetResult(); + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + public static void Delete(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn) + { + operations.DeleteAsync(resourceGroupName, serverName, outboundRuleFqdn).GetAwaiter().GetResult(); + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + public static IPage ListByServer(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + public static OutboundFirewallRule BeginCreateOrUpdate(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn).GetAwaiter().GetResult(); + } + + /// + /// Create a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + public static void BeginDelete(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn) + { + operations.BeginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn).GetAwaiter().GetResult(); + } + + /// + /// Deletes a outbound firewall rule with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOutboundFirewallRulesOperations operations, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, outboundRuleFqdn, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IOutboundFirewallRulesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all outbound firewall rules on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IOutboundFirewallRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs index 366c1685eb2f..cac154a1311b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -102,7 +102,10 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -351,7 +353,10 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +366,6 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -372,9 +376,9 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -482,7 +486,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -562,7 +566,10 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -574,7 +581,6 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -586,9 +592,9 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -769,7 +775,10 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -780,7 +789,6 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -792,9 +800,9 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1057,7 +1065,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs index 8c2d1eacd2e7..0112e85c7c93 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs @@ -95,7 +95,10 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -116,9 +118,9 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -297,7 +299,10 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,7 +313,6 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("groupName", groupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -320,9 +324,9 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -603,7 +607,7 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs similarity index 78% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs index 173bd295dafa..e67b6245074d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServerUsagesOperations operations. + /// RecommendedSensitivityLabelsOperations operations. /// - internal partial class ServerUsagesOperations : IServiceOperations, IServerUsagesOperations + internal partial class RecommendedSensitivityLabelsOperations : IServiceOperations, IRecommendedSensitivityLabelsOperations { /// - /// Initializes a new instance of the ServerUsagesOperations class. + /// Initializes a new instance of the RecommendedSensitivityLabelsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServerUsagesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServerUsagesOperations(SqlManagementClient client) + internal RecommendedSensitivityLabelsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,8 @@ internal ServerUsagesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Returns server usages. + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,6 +61,11 @@ internal ServerUsagesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The name of the database. + /// + /// + /// /// /// Headers that will be added to request. /// @@ -69,9 +75,6 @@ internal ServerUsagesOperations(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 /// @@ -81,12 +84,8 @@ internal ServerUsagesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -95,7 +94,22 @@ internal ServerUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -103,22 +117,24 @@ internal ServerUsagesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels").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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -127,7 +143,7 @@ internal ServerUsagesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -158,6 +174,12 @@ internal ServerUsagesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -213,31 +235,13 @@ internal ServerUsagesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs index ed686787c6bf..695e35ce9f57 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolDatabaseActivitiesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs @@ -13,18 +13,17 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for ElasticPoolDatabaseActivitiesOperations. + /// Extension methods for RecommendedSensitivityLabelsOperations. /// - public static partial class ElasticPoolDatabaseActivitiesOperationsExtensions + public static partial class RecommendedSensitivityLabelsOperationsExtensions { /// - /// Returns activity on databases inside of an elastic pool. + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. /// /// /// The operations group for this extension method. @@ -36,16 +35,19 @@ public static partial class ElasticPoolDatabaseActivitiesOperationsExtensions /// /// The name of the server. /// - /// - /// The name of the elastic pool. + /// + /// The name of the database. /// - public static IEnumerable ListByElasticPool(this IElasticPoolDatabaseActivitiesOperations operations, string resourceGroupName, string serverName, string elasticPoolName) + /// + /// + public static void Update(this IRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) { - return operations.ListByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName).GetAwaiter().GetResult(); + operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// - /// Returns activity on databases inside of an elastic pool. + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. /// /// /// The operations group for this extension method. @@ -57,18 +59,17 @@ public static IEnumerable ListByElasticPool(this IE /// /// The name of the server. /// - /// - /// The name of the elastic pool. + /// + /// The name of the database. + /// + /// /// /// /// The cancellation token. /// - public static async Task> ListByElasticPoolAsync(this IElasticPoolDatabaseActivitiesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperationsExtensions.cs deleted file mode 100644 index 114f36a98396..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableDatabasesOperationsExtensions.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RecoverableDatabasesOperations. - /// - public static partial class RecoverableDatabasesOperationsExtensions - { - /// - /// Gets a recoverable database, which is a resource representing a database's - /// geo backup - /// - /// - /// 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 RecoverableDatabase Get(this IRecoverableDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Gets a recoverable database, which is a resource representing a database's - /// geo backup - /// - /// - /// 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 Task GetAsync(this IRecoverableDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of recoverable databases - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - public static IEnumerable ListByServer(this IRecoverableDatabasesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of recoverable databases - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IRecoverableDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs index a2411afc748a..868ccb8aa6d8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs @@ -95,7 +95,10 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -116,9 +118,9 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -296,7 +298,10 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,7 +312,6 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("recoverableDatabaseName", recoverableDatabaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -319,9 +323,9 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{recoverableDatabaseName}", System.Uri.EscapeDataString(recoverableDatabaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -602,7 +606,7 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs index 7861ec699f79..9221c1dda95b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs @@ -51,20 +51,17 @@ internal ReplicationLinksOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on 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 server containing the replication link. /// /// - /// The name of the database that has the replication link to be dropped. - /// - /// - /// The ID of the replication link to be deleted. + /// The name of the database containing the replication link. /// /// /// Headers that will be added to request. @@ -75,6 +72,9 @@ internal ReplicationLinksOperations(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 /// @@ -84,12 +84,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -102,11 +98,14 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (linkId == null) + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,26 +113,23 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks").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("{linkId}", System.Uri.EscapeDataString(linkId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -142,7 +138,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -193,7 +189,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -228,13 +224,31 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -243,20 +257,20 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Gets a database replication link. + /// Gets a replication link. /// /// /// 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 server containing the replication link. /// /// - /// The name of the database to get the link for. + /// The name of the database containing the replication link. /// - /// - /// The replication link ID to be retrieved. + /// + /// The name of the replication link. /// /// /// Headers that will be added to request. @@ -279,12 +293,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -297,11 +307,18 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (linkId == null) + if (replicationLinkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "replicationLinkName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -309,26 +326,25 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); + tracingParameters.Add("replicationLinkName", replicationLinkName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{replicationLinkName}").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("{linkId}", System.Uri.EscapeDataString(linkId)); + _url = _url.Replace("{replicationLinkName}", System.Uri.EscapeDataString(replicationLinkName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -456,109 +472,14 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. - /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginUnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Lists a database's replication links. + /// Gets a list of replication links. /// /// /// 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 retrieve links for. + /// The name of the server containing the replication link. /// /// /// Headers that will be added to request. @@ -581,12 +502,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -595,11 +512,14 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (databaseName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -607,24 +527,21 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks").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(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -719,7 +636,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -752,21 +669,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Gets a list of replication links on 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -777,6 +683,9 @@ internal ReplicationLinksOperations(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 /// @@ -786,29 +695,12 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (linkId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -816,27 +708,14 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _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("{linkId}", System.Uri.EscapeDataString(linkId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -844,7 +723,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -895,7 +774,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -930,205 +809,30 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. - /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (linkId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); - } - string apiVersion = "2014-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverAllowDataLoss", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _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("{linkId}", System.Uri.EscapeDataString(linkId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) + // Deserialize Response + if ((int)_statusCode == 200) { - foreach(var _header in customHeaders) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try + catch (JsonException ex) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) + _httpRequest.Dispose(); + if (_httpResponse != null) { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; + _httpResponse.Dispose(); } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { @@ -1138,23 +842,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links. /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1165,6 +856,9 @@ internal ReplicationLinksOperations(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 /// @@ -1174,33 +868,12 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginUnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (linkId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1208,28 +881,14 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUnlink", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _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("{linkId}", System.Uri.EscapeDataString(linkId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1237,7 +896,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1268,12 +927,6 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1294,7 +947,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1329,13 +982,31 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs index 345f961efc83..af43c4225760 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ReplicationLinksOperationsExtensions { /// - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -34,72 +32,18 @@ public static partial class ReplicationLinksOperationsExtensions /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database that has the replication link to be dropped. + /// The name of the database containing the replication link. /// - /// - /// The ID of the replication link to be deleted. - /// - public static void Delete(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) - { - operations.DeleteAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); - } - - /// - /// Deletes a database replication link. Cannot be done during failover. - /// - /// - /// 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 that has the replication link to be dropped. - /// - /// - /// The ID of the replication link to be deleted. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static IPage ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a database replication link. - /// - /// - /// 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 to get the link for. - /// - /// - /// The replication link ID to be retrieved. - /// - public static ReplicationLink Get(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) - { - return operations.GetAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a database replication link. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -109,53 +53,24 @@ public static ReplicationLink Get(this IReplicationLinksOperations operations, s /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database to get the link for. - /// - /// - /// The replication link ID to be retrieved. + /// The name of the database containing the replication link. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - public static void Failover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) - { - operations.FailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Gets a replication link. /// /// /// The operations group for this extension method. @@ -165,25 +80,21 @@ public static void Failover(this IReplicationLinksOperations operations, string /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database containing the replication link. /// - /// - /// The ID of the replication link to be failed over. + /// + /// The name of the replication link. /// - /// - /// The cancellation token. - /// - public static async Task FailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static ReplicationLink Get(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string replicationLinkName) { - (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, replicationLinkName).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Gets a replication link. /// /// /// The operations group for this extension method. @@ -193,155 +104,27 @@ public static void Failover(this IReplicationLinksOperations operations, string /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. + /// The name of the server containing the replication link. /// /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - public static void FailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) - { - operations.FailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. - /// - /// - /// The operations group for this extension method. + /// The name of the database containing the replication link. /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. + /// + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task FailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string replicationLinkName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - public static void Unlink(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) - { - operations.UnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The cancellation token. - /// - public static async Task UnlinkAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists a database's replication links. - /// - /// - /// 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 to retrieve links for. - /// - public static IEnumerable ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Lists a database's replication links. - /// - /// - /// 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 to retrieve links for. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicationLinkName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Gets a list of replication links. /// /// /// The operations group for this extension method. @@ -351,22 +134,15 @@ public static IEnumerable ListByDatabase(this IReplicationLinks /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. + /// The name of the server containing the replication link. /// - public static void BeginFailover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static IPage ListByServer(this IReplicationLinksOperations operations, string resourceGroupName, string serverName) { - operations.BeginFailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Gets a list of replication links. /// /// /// The operations group for this extension method. @@ -376,130 +152,85 @@ public static void BeginFailover(this IReplicationLinksOperations operations, st /// this value from the Azure Resource Manager API or the portal. /// /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. + /// The name of the server containing the replication link. /// /// /// The cancellation token. /// - public static async Task BeginFailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Gets a list of replication links on 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 NextLink from the previous successful call to List operation. /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - public static void BeginFailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static IPage ListByDatabaseNext(this IReplicationLinksOperations operations, string nextPageLink) { - operations.BeginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Gets a list of replication links on 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The cancellation token. /// - public static async Task BeginFailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseNextAsync(this IReplicationLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links. /// /// /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// + /// The NextLink from the previous successful call to List operation. /// - public static void BeginUnlink(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) + public static IPage ListByServerNext(this IReplicationLinksOperations operations, string nextPageLink) { - operations.BeginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links. /// /// /// 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 that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The cancellation token. /// - public static async Task BeginUnlinkAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerNextAsync(this IReplicationLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginUnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs index 166c29c69443..2a694b90521f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs @@ -51,7 +51,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,10 +60,6 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// Headers that will be added to request. /// @@ -85,12 +81,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -99,11 +91,14 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (restorableDroppededDatabaseId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "restorableDroppededDatabaseId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -111,24 +106,21 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("restorableDroppededDatabaseId", restorableDroppededDatabaseId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{restorableDroppededDatabaseId}", System.Uri.EscapeDataString(restorableDroppededDatabaseId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -223,7 +215,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -236,7 +228,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -256,7 +248,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -265,6 +257,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// /// /// Headers that will be added to request. /// @@ -286,12 +280,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -300,7 +290,18 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (restorableDroppedDatabaseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorableDroppedDatabaseId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,23 +309,197 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{restorableDroppedDatabaseId}", System.Uri.EscapeDataString(restorableDroppedDatabaseId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -418,7 +593,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs index 1bf3d18ae714..4f63557659a4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class RestorableDroppedDatabasesOperationsExtensions { /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The operations group for this extension method. @@ -36,17 +34,13 @@ public static partial class RestorableDroppedDatabasesOperationsExtensions /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// - public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppededDatabaseId) + public static IPage ListByServer(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName) { - return operations.GetAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The operations group for this extension method. @@ -58,23 +52,19 @@ public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOper /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, restorableDroppededDatabaseId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The operations group for this extension method. @@ -86,13 +76,15 @@ public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOper /// /// The name of the server. /// - public static IEnumerable ListByServer(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppedDatabaseId) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, restorableDroppedDatabaseId).GetAwaiter().GetResult(); } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The operations group for this extension method. @@ -104,12 +96,48 @@ public static IEnumerable ListByServer(this IRestorab /// /// The name of the server. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, restorableDroppedDatabaseId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IRestorableDroppedDatabasesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IRestorableDroppedDatabasesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs index e29929ae5374..3af7f2bf228f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs @@ -95,7 +95,10 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -116,9 +118,9 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -296,7 +298,10 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,7 +312,6 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -319,9 +323,9 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) _url = _url.Replace("{restorableDroppedDatabaseId}", System.Uri.EscapeDataString(restorableDroppedDatabaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -602,7 +606,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs index f3108b1e8304..be66e4eca346 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs @@ -84,7 +84,7 @@ internal RestorePointsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -102,7 +102,10 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal RestorePointsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -125,9 +127,9 @@ internal RestorePointsOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -222,7 +224,7 @@ internal RestorePointsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -342,7 +344,10 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal RestorePointsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("restorePointName", restorePointName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -367,9 +371,9 @@ internal RestorePointsOperations(SqlManagementClient client) _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -552,7 +556,10 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -564,7 +571,6 @@ internal RestorePointsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("restorePointName", restorePointName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -577,9 +583,9 @@ internal RestorePointsOperations(SqlManagementClient client) _url = _url.Replace("{restorePointName}", System.Uri.EscapeDataString(restorePointName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -751,7 +757,10 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -763,7 +772,6 @@ internal RestorePointsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } @@ -775,9 +783,9 @@ internal RestorePointsOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -928,5 +936,178 @@ internal RestorePointsOperations(SqlManagementClient client) return _result; } + /// + /// Gets a list of database restore points. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs index 225555ac69a6..c7f541c5ee98 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -39,7 +37,7 @@ public static partial class RestorePointsOperationsExtensions /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } @@ -63,7 +61,7 @@ public static IEnumerable ListByDatabase(this IRestorePointsOperat /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -284,5 +282,39 @@ public static RestorePoint BeginCreate(this IRestorePointsOperations operations, } } + /// + /// Gets a list of database restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IRestorePointsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IRestorePointsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs index feab62484021..21ba7b0fbfb6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs @@ -19,106 +19,114 @@ public static IEnumerable> ApiInfo_SqlManagementCl { return new Tuple[] { - new Tuple("Sql", "BackupShortTermRetentionPolicies", "2017-10-01-preview"), - new Tuple("Sql", "Capabilities", "2020-08-01-preview"), - new Tuple("Sql", "DataMaskingPolicies", "2014-04-01"), - new Tuple("Sql", "DataMaskingRules", "2014-04-01"), - new Tuple("Sql", "DatabaseAutomaticTuning", "2015-05-01-preview"), - new Tuple("Sql", "DatabaseBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "DatabaseOperations", "2017-10-01-preview"), - new Tuple("Sql", "DatabaseThreatDetectionPolicies", "2014-04-01"), - new Tuple("Sql", "DatabaseUsages", "2014-04-01"), - new Tuple("Sql", "DatabaseVulnerabilityAssessmentRuleBaselines", "2017-03-01-preview"), - new Tuple("Sql", "DatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), - new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2017-03-01-preview"), - new Tuple("Sql", "Databases", "2014-04-01"), - new Tuple("Sql", "Databases", "2020-02-02-preview"), - new Tuple("Sql", "Databases", "2020-11-01-preview"), - new Tuple("Sql", "ElasticPoolActivities", "2014-04-01"), - new Tuple("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"), - new Tuple("Sql", "ElasticPoolOperations", "2017-10-01-preview"), - new Tuple("Sql", "ElasticPools", "2014-04-01"), - new Tuple("Sql", "ElasticPools", "2020-08-01-preview"), - new Tuple("Sql", "EncryptionProtectors", "2015-05-01-preview"), - new Tuple("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ExtendedServerBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "FailoverGroups", "2015-05-01-preview"), - new Tuple("Sql", "FirewallRules", "2014-04-01"), - new Tuple("Sql", "GeoBackupPolicies", "2014-04-01"), - new Tuple("Sql", "ImportExport", "2020-02-02-preview"), - new Tuple("Sql", "InstanceFailoverGroups", "2017-10-01-preview"), - new Tuple("Sql", "InstancePools", "2018-06-01-preview"), - new Tuple("Sql", "JobAgents", "2017-03-01-preview"), - new Tuple("Sql", "JobCredentials", "2017-03-01-preview"), - new Tuple("Sql", "JobExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobStepExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobSteps", "2017-03-01-preview"), - new Tuple("Sql", "JobTargetExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobTargetGroups", "2017-03-01-preview"), - new Tuple("Sql", "JobVersions", "2017-03-01-preview"), - new Tuple("Sql", "Jobs", "2017-03-01-preview"), - new Tuple("Sql", "LongTermRetentionBackups", "2020-11-01-preview"), - new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2018-06-01-preview"), - new Tuple("Sql", "LongTermRetentionPolicies", "2020-11-01-preview"), - new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2020-02-02-preview"), - new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2018-06-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabases", "2020-02-02-preview"), - new Tuple("Sql", "ManagedInstanceAdministrators", "2017-03-01-preview"), - new Tuple("Sql", "ManagedInstanceAzureADOnlyAuthentications", "2020-02-02-preview"), - new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceKeys", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceLongTermRetentionPolicies", "2018-06-01-preview"), - new Tuple("Sql", "ManagedInstanceOperations", "2019-06-01-preview"), - new Tuple("Sql", "ManagedInstanceTdeCertificates", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2018-06-01-preview"), - new Tuple("Sql", "ManagedInstances", "2020-02-02-preview"), - new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "Operations", "2015-05-01-preview"), - new Tuple("Sql", "PrivateEndpointConnections", "2020-11-01-preview"), - new Tuple("Sql", "PrivateLinkResources", "2018-06-01-preview"), - new Tuple("Sql", "RecommendedElasticPools", "2014-04-01"), - new Tuple("Sql", "RecoverableDatabases", "2014-04-01"), - new Tuple("Sql", "RecoverableManagedDatabases", "2017-10-01-preview"), - new Tuple("Sql", "ReplicationLinks", "2014-04-01"), - new Tuple("Sql", "RestorableDroppedDatabases", "2014-04-01"), - new Tuple("Sql", "RestorableDroppedManagedDatabases", "2017-03-01-preview"), - new Tuple("Sql", "RestorePoints", "2017-03-01-preview"), - new Tuple("Sql", "SensitivityLabels", "2017-03-01-preview"), - new Tuple("Sql", "ServerAutomaticTuning", "2017-03-01-preview"), - new Tuple("Sql", "ServerAzureADAdministrators", "2019-06-01-preview"), - new Tuple("Sql", "ServerAzureADOnlyAuthentications", "2020-02-02-preview"), - new Tuple("Sql", "ServerBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ServerCommunicationLinks", "2014-04-01"), - new Tuple("Sql", "ServerConnectionPolicies", "2014-04-01"), - new Tuple("Sql", "ServerDevOpsAuditSettings", "2020-08-01-preview"), - new Tuple("Sql", "ServerDnsAliases", "2017-03-01-preview"), - new Tuple("Sql", "ServerKeys", "2015-05-01-preview"), - new Tuple("Sql", "ServerSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ServerTrustGroups", "2020-02-02-preview"), - new Tuple("Sql", "ServerUsages", "2014-04-01"), - new Tuple("Sql", "ServerVulnerabilityAssessments", "2018-06-01-preview"), - new Tuple("Sql", "Servers", "2019-06-01-preview"), - new Tuple("Sql", "Servers", "2020-02-02-preview"), - new Tuple("Sql", "ServiceObjectives", "2014-04-01"), - new Tuple("Sql", "ServiceTierAdvisors", "2014-04-01"), - new Tuple("Sql", "SubscriptionUsages", "2015-05-01-preview"), - new Tuple("Sql", "SyncAgents", "2015-05-01-preview"), - new Tuple("Sql", "SyncGroups", "2019-06-01-preview"), - new Tuple("Sql", "SyncMembers", "2019-06-01-preview"), - new Tuple("Sql", "TdeCertificates", "2017-10-01-preview"), - new Tuple("Sql", "TransparentDataEncryptionActivities", "2014-04-01"), - new Tuple("Sql", "TransparentDataEncryptions", "2014-04-01"), - new Tuple("Sql", "Usages", "2018-06-01-preview"), - new Tuple("Sql", "VirtualClusters", "2015-05-01-preview"), - new Tuple("Sql", "VirtualNetworkRules", "2015-05-01-preview"), - new Tuple("Sql", "WorkloadClassifiers", "2019-06-01-preview"), - new Tuple("Sql", "WorkloadGroups", "2019-06-01-preview"), + new Tuple("Sql", "BackupShortTermRetentionPolicies", "2021-02-01-preview"), + new Tuple("Sql", "Capabilities", "2021-02-01-preview"), + new Tuple("Sql", "DataWarehouseUserActivities", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseAdvisors", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseAutomaticTuning", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseBlobAuditingPolicies", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseColumns", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseExtensions", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseOperations", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseRecommendedActions", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseSchemas", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseSecurityAlertPolicies", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseTables", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseUsages", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessmentRuleBaselines", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessmentScans", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2021-02-01-preview"), + new Tuple("Sql", "Databases", "2021-02-01-preview"), + new Tuple("Sql", "DeletedServers", "2021-02-01-preview"), + new Tuple("Sql", "ElasticPoolOperations", "2021-02-01-preview"), + new Tuple("Sql", "ElasticPools", "2021-02-01-preview"), + new Tuple("Sql", "EncryptionProtectors", "2021-02-01-preview"), + new Tuple("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ExtendedServerBlobAuditingPolicies", "2021-02-01-preview"), + new Tuple("Sql", "FailoverGroups", "2021-02-01-preview"), + new Tuple("Sql", "FirewallRules", "2021-02-01-preview"), + new Tuple("Sql", "InstanceFailoverGroups", "2021-02-01-preview"), + new Tuple("Sql", "InstancePools", "2021-02-01-preview"), + new Tuple("Sql", "JobAgents", "2021-02-01-preview"), + new Tuple("Sql", "JobCredentials", "2021-02-01-preview"), + new Tuple("Sql", "JobExecutions", "2021-02-01-preview"), + new Tuple("Sql", "JobStepExecutions", "2021-02-01-preview"), + new Tuple("Sql", "JobSteps", "2021-02-01-preview"), + new Tuple("Sql", "JobTargetExecutions", "2021-02-01-preview"), + new Tuple("Sql", "JobTargetGroups", "2021-02-01-preview"), + new Tuple("Sql", "JobVersions", "2021-02-01-preview"), + new Tuple("Sql", "Jobs", "2021-02-01-preview"), + new Tuple("Sql", "LedgerDigestUploads", "2021-02-01-preview"), + new Tuple("Sql", "LongTermRetentionBackups", "2021-02-01-preview"), + new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2021-02-01-preview"), + new Tuple("Sql", "LongTermRetentionPolicies", "2021-02-01-preview"), + new Tuple("Sql", "MaintenanceWindowOptions", "2021-02-01-preview"), + new Tuple("Sql", "MaintenanceWindows", "2021-02-01-preview"), + new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseColumns", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseQueries", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseRecommendedSensitivityLabels", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseSchemas", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseSecurityEvents", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseTables", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseTransparentDataEncryption", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2021-02-01-preview"), + new Tuple("Sql", "ManagedDatabases", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceAdministrators", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceAzureADOnlyAuthentications", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceKeys", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceLongTermRetentionPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceOperations", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstancePrivateEndpointConnections", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstancePrivateLinkResources", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceTdeCertificates", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2021-02-01-preview"), + new Tuple("Sql", "ManagedInstances", "2021-02-01-preview"), + new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2021-02-01-preview"), + new Tuple("Sql", "Operations", "2021-02-01-preview"), + new Tuple("Sql", "OperationsHealth", "2021-02-01-preview"), + new Tuple("Sql", "OutboundFirewallRules", "2021-02-01-preview"), + new Tuple("Sql", "PrivateEndpointConnections", "2021-02-01-preview"), + new Tuple("Sql", "PrivateLinkResources", "2021-02-01-preview"), + new Tuple("Sql", "RecommendedSensitivityLabels", "2021-02-01-preview"), + new Tuple("Sql", "RecoverableManagedDatabases", "2021-02-01-preview"), + new Tuple("Sql", "ReplicationLinks", "2021-02-01-preview"), + new Tuple("Sql", "RestorableDroppedDatabases", "2021-02-01-preview"), + new Tuple("Sql", "RestorableDroppedManagedDatabases", "2021-02-01-preview"), + new Tuple("Sql", "RestorePoints", "2021-02-01-preview"), + new Tuple("Sql", "SensitivityLabels", "2021-02-01-preview"), + new Tuple("Sql", "ServerAdvisors", "2021-02-01-preview"), + new Tuple("Sql", "ServerAutomaticTuning", "2021-02-01-preview"), + new Tuple("Sql", "ServerAzureADAdministrators", "2021-02-01-preview"), + new Tuple("Sql", "ServerAzureADOnlyAuthentications", "2021-02-01-preview"), + new Tuple("Sql", "ServerBlobAuditingPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ServerDevOpsAuditSettings", "2021-02-01-preview"), + new Tuple("Sql", "ServerDnsAliases", "2021-02-01-preview"), + new Tuple("Sql", "ServerKeys", "2021-02-01-preview"), + new Tuple("Sql", "ServerOperations", "2021-02-01-preview"), + new Tuple("Sql", "ServerSecurityAlertPolicies", "2021-02-01-preview"), + new Tuple("Sql", "ServerTrustGroups", "2021-02-01-preview"), + new Tuple("Sql", "ServerVulnerabilityAssessments", "2021-02-01-preview"), + new Tuple("Sql", "Servers", "2021-02-01-preview"), + new Tuple("Sql", "SqlAgent", "2021-02-01-preview"), + new Tuple("Sql", "SubscriptionUsages", "2021-02-01-preview"), + new Tuple("Sql", "SyncAgents", "2021-02-01-preview"), + new Tuple("Sql", "SyncGroups", "2021-02-01-preview"), + new Tuple("Sql", "SyncMembers", "2021-02-01-preview"), + new Tuple("Sql", "TdeCertificates", "2021-02-01-preview"), + new Tuple("Sql", "TimeZones", "2021-02-01-preview"), + new Tuple("Sql", "TransparentDataEncryptions", "2021-02-01-preview"), + new Tuple("Sql", "VirtualClusters", "2021-02-01-preview"), + new Tuple("Sql", "VirtualNetworkRules", "2021-02-01-preview"), + new Tuple("Sql", "WorkloadClassifiers", "2021-02-01-preview"), + new Tuple("Sql", "WorkloadGroups", "2021-02-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs index 0dd4fe37efe6..6d350d467e9c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs @@ -67,6 +67,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// Headers that will be added to request. /// @@ -88,7 +92,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -106,7 +110,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -118,7 +125,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("count", count); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); } @@ -138,9 +146,17 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (skipToken != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (count != null) + { + _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -248,7 +264,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -267,6 +283,204 @@ internal SensitivityLabelsOperations(SqlManagementClient client) return _result; } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// 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 a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels").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(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets the sensitivity labels of a given database /// @@ -283,11 +497,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// Headers that will be added to request. /// @@ -309,7 +523,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -327,7 +541,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -339,9 +556,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("skipToken", skipToken); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); } @@ -361,17 +577,17 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (includeDisabledRecommendations != null) - { - _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); - } if (skipToken != null) { _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); } - if (apiVersion != null) + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -479,7 +695,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -569,8 +785,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "recommended"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -585,7 +804,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); } @@ -601,9 +819,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -782,8 +1000,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "recommended"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -798,7 +1019,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DisableRecommendation", tracingParameters); } @@ -814,9 +1034,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1002,7 +1222,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1017,7 +1240,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -1033,9 +1255,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1242,8 +1464,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "current"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1259,7 +1484,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -1275,9 +1499,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1498,8 +1722,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string sensitivityLabelSource = "current"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1514,7 +1741,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1530,9 +1756,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1795,7 +2021,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1968,7 +2194,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs index a647ae07ee4a..16d206000767 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs @@ -41,9 +41,13 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListCurrentByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// + /// + /// + public static IPage ListCurrentByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) { - return operations.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); + return operations.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); } /// @@ -65,17 +69,70 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListCurrentByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListCurrentByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// 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 void Update(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// 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 Task UpdateAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets the sensitivity labels of a given database /// @@ -95,14 +152,14 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// - public static IPage ListRecommendedByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string)) + public static IPage ListRecommendedByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) { - return operations.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, includeDisabledRecommendations, skipToken).GetAwaiter().GetResult(); + return operations.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); } /// @@ -124,17 +181,17 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The cancellation token. /// - public static async Task> ListRecommendedByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListRecommendedByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, includeDisabledRecommendations, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs similarity index 85% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs index 8f5b8001213f..17e752339a18 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// RecommendedElasticPoolsOperations operations. + /// ServerAdvisorsOperations operations. /// - internal partial class RecommendedElasticPoolsOperations : IServiceOperations, IRecommendedElasticPoolsOperations + internal partial class ServerAdvisorsOperations : IServiceOperations, IServerAdvisorsOperations { /// - /// Initializes a new instance of the RecommendedElasticPoolsOperations class. + /// Initializes a new instance of the ServerAdvisorsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class RecommendedElasticPoolsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal RecommendedElasticPoolsOperations(SqlManagementClient client) + internal ServerAdvisorsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,8 +60,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// /// /// Headers that will be added to request. @@ -84,12 +84,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -98,11 +94,14 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (recommendedElasticPoolName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,24 +109,26 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("recommendedElasticPoolName", recommendedElasticPoolName); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -222,7 +223,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +236,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -255,7 +256,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -264,6 +265,9 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// Headers that will be added to request. /// @@ -285,12 +289,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -299,7 +299,18 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,22 +318,23 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("advisorName", advisorName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -417,7 +429,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -430,7 +442,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -450,7 +462,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -459,8 +471,11 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The name of the Server Advisor. + /// + /// + /// The requested advisor resource state. /// /// /// Headers that will be added to request. @@ -483,12 +498,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -497,11 +508,22 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (recommendedElasticPoolName == null) + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -509,24 +531,24 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("recommendedElasticPoolName", recommendedElasticPoolName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -535,7 +557,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -566,6 +588,12 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -621,7 +649,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -634,7 +662,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs similarity index 61% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs index 1cb689bd8c2a..9d9d309a2132 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for RecommendedElasticPoolsOperations. + /// Extension methods for ServerAdvisorsOperations. /// - public static partial class RecommendedElasticPoolsOperationsExtensions + public static partial class ServerAdvisorsOperationsExtensions { /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The operations group for this extension method. @@ -36,16 +36,16 @@ public static partial class RecommendedElasticPoolsOperationsExtensions /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// - public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName) + public static IList ListByServer(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, serverName, recommendedElasticPoolName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName, expand).GetAwaiter().GetResult(); } /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The operations group for this extension method. @@ -57,22 +57,22 @@ public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The operations group for this extension method. @@ -84,13 +84,16 @@ public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations /// /// The name of the server. /// - public static IEnumerable ListByServer(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the Server Advisor. + /// + public static Advisor Get(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, advisorName).GetAwaiter().GetResult(); } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The operations group for this extension method. @@ -102,19 +105,22 @@ public static IEnumerable ListByServer(this IRecommended /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, advisorName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The operations group for this extension method. @@ -126,16 +132,19 @@ public static IEnumerable ListByServer(this IRecommended /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The name of the Server Advisor. /// - public static IEnumerable ListMetrics(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName) + /// + /// The requested advisor resource state. + /// + public static Advisor Update(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, Advisor parameters) { - return operations.ListMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serverName, advisorName, parameters).GetAwaiter().GetResult(); } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The operations group for this extension method. @@ -147,15 +156,18 @@ public static IEnumerable ListMetrics(this IRecomm /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The name of the Server Advisor. + /// + /// + /// The requested advisor resource state. /// /// /// The cancellation token. /// - public static async Task> ListMetricsAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, advisorName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs index 53f679eaf559..3c674a24787d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs @@ -95,7 +95,10 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -116,9 +118,9 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -297,7 +299,10 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,7 +313,6 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -319,9 +323,9 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs index 4b7546f19acc..5d5ee34ba584 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs @@ -83,10 +83,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -95,7 +91,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -104,7 +107,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); @@ -114,14 +116,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -330,10 +332,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -342,7 +340,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -350,7 +355,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -359,13 +363,13 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -473,7 +477,7 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -528,10 +532,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAzureADAdministrator parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -548,7 +548,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { parameters.Validate(); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -557,7 +564,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); @@ -568,14 +574,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -756,10 +762,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -768,7 +770,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string administratorName = "ActiveDirectory"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -777,7 +786,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); @@ -787,14 +795,14 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1057,7 +1065,7 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs index b0cc0491829b..10e123f12c39 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs @@ -95,8 +95,11 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("authenticationName", authenticationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -344,7 +346,10 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -365,9 +369,9 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -475,7 +479,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -552,8 +556,11 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -565,7 +572,6 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("authenticationName", authenticationName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -577,9 +583,9 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -772,8 +778,11 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -784,7 +793,6 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("authenticationName", authenticationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -796,9 +804,9 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _url = _url.Replace("{authenticationName}", System.Uri.EscapeDataString(authenticationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1061,7 +1069,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs index 9e3e362d7bde..fe004111bc58 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs @@ -95,8 +95,11 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -319,7 +321,10 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,7 +334,6 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -340,9 +344,9 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -450,7 +454,7 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -525,8 +529,11 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,7 +545,6 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -550,9 +556,9 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -839,7 +845,7 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperations.cs deleted file mode 100644 index 4f9dd45213eb..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperations.cs +++ /dev/null @@ -1,486 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ServerConnectionPoliciesOperations operations. - /// - internal partial class ServerConnectionPoliciesOperations : IServiceOperations, IServerConnectionPoliciesOperations - { - /// - /// Initializes a new instance of the ServerConnectionPoliciesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServerConnectionPoliciesOperations(SqlManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SqlManagementClient - /// - public SqlManagementClient Client { get; private set; } - - /// - /// Creates or updates the server's connection policy. - /// - /// - /// 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 required parameters for updating a secure connection policy. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerConnectionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2014-04-01"; - string connectionPolicyName = "default"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("connectionPolicyName", connectionPolicyName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{connectionPolicyName}", System.Uri.EscapeDataString(connectionPolicyName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the server's secure connection policy. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2014-04-01"; - string connectionPolicyName = "default"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("connectionPolicyName", connectionPolicyName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{connectionPolicyName}", System.Uri.EscapeDataString(connectionPolicyName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs index deda3a3b4202..511dd1004090 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs @@ -102,7 +102,10 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("devOpsAuditingSettingsName", devOpsAuditingSettingsName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) _url = _url.Replace("{devOpsAuditingSettingsName}", System.Uri.EscapeDataString(devOpsAuditingSettingsName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -328,7 +330,10 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -338,7 +343,6 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -349,9 +353,9 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -459,7 +463,7 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -541,7 +545,10 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -553,7 +560,6 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("devOpsAuditingSettingsName", devOpsAuditingSettingsName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -565,9 +571,9 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) _url = _url.Replace("{devOpsAuditingSettingsName}", System.Uri.EscapeDataString(devOpsAuditingSettingsName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -854,7 +860,7 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs index aaa2a4984245..77c1124298a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs @@ -61,7 +61,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// Headers that will be added to request. @@ -102,7 +102,10 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("dnsAliasName", dnsAliasName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -255,7 +257,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -265,7 +267,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -291,7 +293,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The headers that will be added to request. @@ -351,7 +353,10 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +366,6 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -372,9 +376,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -482,7 +486,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -522,15 +526,15 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -540,7 +544,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// Headers that will be added to request. @@ -581,7 +585,10 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -592,7 +599,6 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("dnsAliasName", dnsAliasName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -604,9 +610,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -762,7 +768,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// Headers that will be added to request. @@ -800,7 +806,10 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -811,7 +820,6 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("dnsAliasName", dnsAliasName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -823,9 +831,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -958,6 +966,9 @@ internal ServerDnsAliasesOperations(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 /// @@ -967,7 +978,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -985,11 +996,18 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1001,7 +1019,6 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("dnsAliasName", dnsAliasName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginAcquire", tracingParameters); } @@ -1013,9 +1030,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1116,13 +1133,31 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1284,7 +1319,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs index d59b5f284a4e..591e3712aeb0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs @@ -35,7 +35,7 @@ public static partial class ServerDnsAliasesOperationsExtensions /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -56,7 +56,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The cancellation token. @@ -70,7 +70,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -83,7 +83,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -91,7 +91,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -104,7 +104,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The cancellation token. @@ -131,7 +131,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// public static void Delete(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -152,7 +152,7 @@ public static void Delete(this IServerDnsAliasesOperations operations, string re /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The cancellation token. @@ -222,9 +222,9 @@ public static IPage ListByServer(this IServerDnsAliasesOperation /// /// /// - public static void Acquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) + public static ServerDnsAlias Acquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) { - operations.AcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); + return operations.AcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); } /// @@ -248,13 +248,16 @@ public static void Acquire(this IServerDnsAliasesOperations operations, string r /// /// The cancellation token. /// - public static async Task AcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.AcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.AcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -267,7 +270,7 @@ public static void Acquire(this IServerDnsAliasesOperations operations, string r /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -275,7 +278,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -288,7 +291,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The cancellation token. @@ -315,7 +318,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// public static void BeginDelete(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -336,7 +339,7 @@ public static void BeginDelete(this IServerDnsAliasesOperations operations, stri /// The name of the server that the alias is pointing to. /// /// - /// The name of the server DNS alias. + /// The name of the server dns alias. /// /// /// The cancellation token. @@ -364,9 +367,9 @@ public static void BeginDelete(this IServerDnsAliasesOperations operations, stri /// /// /// - public static void BeginAcquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) + public static ServerDnsAlias BeginAcquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) { - operations.BeginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); + return operations.BeginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); } /// @@ -390,9 +393,12 @@ public static void BeginAcquire(this IServerDnsAliasesOperations operations, str /// /// The cancellation token. /// - public static async Task BeginAcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginAcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs index 98014ba2d2be..80d0e7e6c145 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs @@ -95,7 +95,10 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,7 +108,6 @@ internal ServerKeysOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -116,9 +118,9 @@ internal ServerKeysOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -226,7 +228,7 @@ internal ServerKeysOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -297,7 +299,10 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,7 +313,6 @@ internal ServerKeysOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -320,9 +324,9 @@ internal ServerKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -463,9 +467,9 @@ internal ServerKeysOperations(SqlManagementClient client) /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -523,9 +527,9 @@ internal ServerKeysOperations(SqlManagementClient client) /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -577,7 +581,10 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -589,7 +596,6 @@ internal ServerKeysOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("keyName", keyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -601,9 +607,9 @@ internal ServerKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -803,7 +809,10 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -814,7 +823,6 @@ internal ServerKeysOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -826,9 +834,9 @@ internal ServerKeysOperations(SqlManagementClient client) _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1091,7 +1099,7 @@ internal ServerKeysOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs index 600dbf3f8eec..aaa9e6e63847 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs @@ -128,9 +128,9 @@ public static ServerKey Get(this IServerKeysOperations operations, string resour /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -157,9 +157,9 @@ public static ServerKey CreateOrUpdate(this IServerKeysOperations operations, st /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -237,9 +237,9 @@ public static void Delete(this IServerKeysOperations operations, string resource /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -266,9 +266,9 @@ public static ServerKey BeginCreateOrUpdate(this IServerKeysOperations operation /// The name of the server key to be operated on (updated or created). The key /// name is required to be in the format of 'vault_key_version'. For example, /// if the keyId is - /// https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then + /// the server key name should be formatted as: + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs similarity index 87% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs index 1744c63f95b7..5ce4fe2d1cdc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// UsagesOperations operations. + /// ServerOperations operations. /// - internal partial class UsagesOperations : IServiceOperations, IUsagesOperations + internal partial class ServerOperations : IServiceOperations, IServerOperations { /// - /// Initializes a new instance of the UsagesOperations class. + /// Initializes a new instance of the ServerOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class UsagesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal UsagesOperations(SqlManagementClient client) + internal ServerOperations(SqlManagementClient client) { if (client == null) { @@ -51,18 +51,14 @@ internal UsagesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// 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 instance pool to be retrieved. - /// - /// - /// Optional request parameter to include managed instance usages within the - /// instance pool. + /// + /// The name of the server. /// /// /// Headers that will be added to request. @@ -85,21 +81,24 @@ internal UsagesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, bool? expandChildren = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (instancePoolName == null) + if (serverName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "instancePoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -108,26 +107,20 @@ internal UsagesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("instancePoolName", instancePoolName); - tracingParameters.Add("expandChildren", expandChildren); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePool", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operations").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (expandChildren != null) - { - _queryParameters.Add(string.Format("expandChildren={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expandChildren, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -222,7 +215,7 @@ internal UsagesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +228,7 @@ internal UsagesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -255,7 +248,7 @@ internal UsagesOperations(SqlManagementClient client) } /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The NextLink from the previous successful call to List operation. @@ -281,7 +274,7 @@ internal UsagesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -296,7 +289,7 @@ internal UsagesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePoolNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -395,7 +388,7 @@ internal UsagesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -408,7 +401,7 @@ internal UsagesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs similarity index 53% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs index 446fd93cc838..02a148ef049a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs @@ -17,12 +17,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for UsagesOperations. + /// Extension methods for ServerOperations. /// - public static partial class UsagesOperationsExtensions + public static partial class ServerOperationsExtensions { /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The operations group for this extension method. @@ -31,20 +31,16 @@ public static partial class UsagesOperationsExtensions /// 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 instance pool to be retrieved. + /// + /// The name of the server. /// - /// - /// Optional request parameter to include managed instance usages within the - /// instance pool. - /// - public static IPage ListByInstancePool(this IUsagesOperations operations, string resourceGroupName, string instancePoolName, bool? expandChildren = default(bool?)) + public static IPage ListByServer(this IServerOperations operations, string resourceGroupName, string serverName) { - return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expandChildren).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The operations group for this extension method. @@ -53,26 +49,22 @@ public static partial class UsagesOperationsExtensions /// 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 instance pool to be retrieved. - /// - /// - /// Optional request parameter to include managed instance usages within the - /// instance pool. + /// + /// The name of the server. /// /// /// The cancellation token. /// - public static async Task> ListByInstancePoolAsync(this IUsagesOperations operations, string resourceGroupName, string instancePoolName, bool? expandChildren = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IServerOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, expandChildren, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The operations group for this extension method. @@ -80,13 +72,13 @@ public static partial class UsagesOperationsExtensions /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByInstancePoolNext(this IUsagesOperations operations, string nextPageLink) + public static IPage ListByServerNext(this IServerOperations operations, string nextPageLink) { - return operations.ListByInstancePoolNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets all instance pool usage metrics + /// Gets a list of operations performed on the server. /// /// /// The operations group for this extension method. @@ -97,9 +89,9 @@ public static IPage ListByInstancePoolNext(this IUsagesOperations operati /// /// The cancellation token. /// - public static async Task> ListByInstancePoolNextAsync(this IUsagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerNextAsync(this IServerOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs index d66ce161ec76..a8ac49a2d69a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs @@ -95,8 +95,11 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -319,7 +321,10 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,7 +334,6 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -340,9 +344,9 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -450,7 +454,7 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -525,8 +529,11 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,7 +545,6 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -550,9 +556,9 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -839,7 +845,7 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs index 9edbfc899633..3302e0ac6260 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs @@ -102,7 +102,10 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("serverTrustGroupName", serverTrustGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _url = _url.Replace("{serverTrustGroupName}", System.Uri.EscapeDataString(serverTrustGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -354,7 +356,10 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -364,7 +369,6 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -375,9 +379,9 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -485,7 +489,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -549,7 +553,10 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -559,7 +566,6 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", tracingParameters); } @@ -570,9 +576,9 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -680,7 +686,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -762,7 +768,10 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -774,7 +783,6 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) tracingParameters.Add("locationName", locationName); tracingParameters.Add("serverTrustGroupName", serverTrustGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -786,9 +794,9 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _url = _url.Replace("{serverTrustGroupName}", System.Uri.EscapeDataString(serverTrustGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -988,7 +996,10 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -999,7 +1010,6 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("serverTrustGroupName", serverTrustGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1011,9 +1021,9 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _url = _url.Replace("{serverTrustGroupName}", System.Uri.EscapeDataString(serverTrustGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1276,7 +1286,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1449,7 +1459,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperationsExtensions.cs deleted file mode 100644 index b6b826799f99..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerUsagesOperationsExtensions.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServerUsagesOperations. - /// - public static partial class ServerUsagesOperationsExtensions - { - /// - /// Returns server usages. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - public static IEnumerable ListByServer(this IServerUsagesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Returns server usages. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IServerUsagesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs index d1bf7937ec97..b513ce694767 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs @@ -95,8 +95,11 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -107,7 +110,6 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -119,9 +121,9 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -304,8 +306,11 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -317,7 +322,6 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -329,9 +333,9 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -524,8 +528,11 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -536,7 +543,6 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -548,9 +554,9 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -704,7 +710,10 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -714,7 +723,6 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -725,9 +733,9 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -835,7 +843,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1008,7 +1016,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs index 6fb27c3a7ea6..9b6c6b9f9258 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs @@ -57,6 +57,9 @@ internal ServersOperations(SqlManagementClient client) /// 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 child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -78,7 +81,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -88,7 +91,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -97,7 +103,7 @@ internal ServersOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -107,9 +113,13 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -217,7 +227,7 @@ internal ServersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -246,6 +256,9 @@ internal ServersOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -267,7 +280,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -281,7 +294,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -291,7 +307,7 @@ internal ServersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -302,9 +318,13 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -509,6 +529,9 @@ internal ServersOperations(SqlManagementClient client) /// /// Gets a list of all servers in the subscription. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -530,13 +553,16 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -544,7 +570,7 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -553,9 +579,13 @@ internal ServersOperations(SqlManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -663,7 +693,7 @@ internal ServersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -682,6 +712,32 @@ internal ServersOperations(SqlManagementClient client) return _result; } + /// + /// 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 database import request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Determines whether a resource can be created with the specified name. /// @@ -723,7 +779,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -732,7 +791,6 @@ internal ServersOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); } @@ -741,9 +799,9 @@ internal ServersOperations(SqlManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -876,32 +934,6 @@ internal ServersOperations(SqlManagementClient client) return _result; } - /// - /// 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 database import request parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Creates or updates a server. /// @@ -958,7 +990,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -969,7 +1004,6 @@ internal ServersOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -980,9 +1014,9 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1175,7 +1209,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1185,7 +1222,6 @@ internal ServersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1196,9 +1232,9 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1359,7 +1395,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1370,7 +1409,6 @@ internal ServersOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1381,9 +1419,9 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1572,7 +1610,10 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1583,7 +1624,6 @@ internal ServersOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginImportDatabase", tracingParameters); } @@ -1594,9 +1634,9 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1883,7 +1923,7 @@ internal ServersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2056,7 +2096,7 @@ internal ServersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs index 89784f56684a..c4c0511a94f4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs @@ -31,9 +31,12 @@ public static partial class ServersOperationsExtensions /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName, string expand = default(string)) { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName, expand).GetAwaiter().GetResult(); } /// @@ -46,12 +49,15 @@ public static IPage ListByResourceGroup(this IServersOperations operatio /// 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 child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -70,9 +76,12 @@ public static IPage ListByResourceGroup(this IServersOperations operatio /// /// The name of the server. /// - public static Server Get(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The child resources to include in the response. + /// + public static Server Get(this IServersOperations operations, string resourceGroupName, string serverName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, expand).GetAwaiter().GetResult(); } /// @@ -88,12 +97,15 @@ public static Server Get(this IServersOperations operations, string resourceGrou /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IServersOperations operations, string resourceGroupName, string serverName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -240,9 +252,12 @@ public static Server Update(this IServersOperations operations, string resourceG /// /// The operations group for this extension method. /// - public static IPage List(this IServersOperations operations) + /// + /// The child resources to include in the response. + /// + public static IPage List(this IServersOperations operations, string expand = default(string)) { - return operations.ListAsync().GetAwaiter().GetResult(); + return operations.ListAsync(expand).GetAwaiter().GetResult(); } /// @@ -251,94 +266,97 @@ public static IPage List(this IServersOperations operations) /// /// The operations group for this extension method. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IServersOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Determines whether a resource can be created with the specified name. + /// 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 availability request parameters. + /// The database import request parameters. /// - public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) + public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) { - return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); + return operations.ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Determines whether a resource can be created with the specified name. + /// 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 availability request parameters. + /// The database import request parameters. /// /// /// The cancellation token. /// - public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified name. /// /// /// 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 database import request parameters. + /// The name availability request parameters. /// - public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) + public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) { - return operations.ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); } /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified name. /// /// /// 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 database import request parameters. + /// The name availability request parameters. /// /// /// The cancellation token. /// - public static async Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperationsExtensions.cs deleted file mode 100644 index 061a6583b943..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperationsExtensions.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServiceObjectivesOperations. - /// - public static partial class ServiceObjectivesOperationsExtensions - { - /// - /// Gets a database service objective. - /// - /// - /// 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 service objective to retrieve. - /// - public static ServiceObjective Get(this IServiceObjectivesOperations operations, string resourceGroupName, string serverName, string serviceObjectiveName) - { - return operations.GetAsync(resourceGroupName, serverName, serviceObjectiveName).GetAwaiter().GetResult(); - } - - /// - /// Gets a database service objective. - /// - /// - /// 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 service objective to retrieve. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServiceObjectivesOperations operations, string resourceGroupName, string serverName, string serviceObjectiveName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, serviceObjectiveName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns database service objectives. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - public static IEnumerable ListByServer(this IServiceObjectivesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Returns database service objectives. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IServiceObjectivesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs similarity index 83% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs index bdca61a1d244..cc35252d5735 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceObjectivesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceObjectivesOperations operations. + /// SqlAgentOperations operations. /// - internal partial class ServiceObjectivesOperations : IServiceOperations, IServiceObjectivesOperations + internal partial class SqlAgentOperations : IServiceOperations, ISqlAgentOperations { /// - /// Initializes a new instance of the ServiceObjectivesOperations class. + /// Initializes a new instance of the SqlAgentOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServiceObjectivesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServiceObjectivesOperations(SqlManagementClient client) + internal SqlAgentOperations(SqlManagementClient client) { if (client == null) { @@ -51,17 +51,14 @@ internal ServiceObjectivesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a database service objective. + /// Gets current instance sql agent configuration. /// /// /// 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 service objective to retrieve. + /// + /// The name of the managed instance. /// /// /// Headers that will be added to request. @@ -84,25 +81,24 @@ internal ServiceObjectivesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string serviceObjectiveName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); } - if (serviceObjectiveName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceObjectiveName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,24 +106,21 @@ internal ServiceObjectivesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("serviceObjectiveName", serviceObjectiveName); + tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/sqlAgent/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{serviceObjectiveName}", System.Uri.EscapeDataString(serviceObjectiveName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -222,7 +215,7 @@ internal ServiceObjectivesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +228,7 @@ internal ServiceObjectivesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -255,14 +248,16 @@ internal ServiceObjectivesOperations(SqlManagementClient client) } /// - /// Returns database service objectives. + /// Puts new sql agent configuration to instance. /// /// /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - /// - /// The name of the server. + /// + /// The name of the managed instance. + /// + /// /// /// /// Headers that will be added to request. @@ -285,21 +280,28 @@ internal ServiceObjectivesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,22 +309,22 @@ internal ServiceObjectivesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/sqlAgent/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -331,7 +333,7 @@ internal ServiceObjectivesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -362,6 +364,12 @@ internal ServiceObjectivesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -417,7 +425,7 @@ internal ServiceObjectivesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -430,7 +438,7 @@ internal ServiceObjectivesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs similarity index 60% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs index 35a89c25ce42..05a0eb37d52f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerConnectionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs @@ -17,12 +17,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for ServerConnectionPoliciesOperations. + /// Extension methods for SqlAgentOperations. /// - public static partial class ServerConnectionPoliciesOperationsExtensions + public static partial class SqlAgentOperationsExtensions { /// - /// Creates or updates the server's connection policy. + /// Gets current instance sql agent configuration. /// /// /// The operations group for this extension method. @@ -31,19 +31,16 @@ public static partial class ServerConnectionPoliciesOperationsExtensions /// 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 managed instance. /// - /// - /// The required parameters for updating a secure connection policy. - /// - public static ServerConnectionPolicy CreateOrUpdate(this IServerConnectionPoliciesOperations operations, string resourceGroupName, string serverName, ServerConnectionPolicy parameters) + public static SqlAgentConfiguration Get(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); } /// - /// Creates or updates the server's connection policy. + /// Gets current instance sql agent configuration. /// /// /// The operations group for this extension method. @@ -52,25 +49,22 @@ public static ServerConnectionPolicy CreateOrUpdate(this IServerConnectionPolici /// 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 required parameters for updating a secure connection policy. + /// + /// The name of the managed instance. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IServerConnectionPoliciesOperations operations, string resourceGroupName, string serverName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets the server's secure connection policy. + /// Puts new sql agent configuration to instance. /// /// /// The operations group for this extension method. @@ -79,16 +73,18 @@ public static ServerConnectionPolicy CreateOrUpdate(this IServerConnectionPolici /// 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 managed instance. /// - public static ServerConnectionPolicy Get(this IServerConnectionPoliciesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static SqlAgentConfiguration CreateOrUpdate(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters) { - return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).GetAwaiter().GetResult(); } /// - /// Gets the server's secure connection policy. + /// Puts new sql agent configuration to instance. /// /// /// The operations group for this extension method. @@ -97,15 +93,17 @@ public static ServerConnectionPolicy Get(this IServerConnectionPoliciesOperation /// 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 managed instance. + /// + /// /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServerConnectionPoliciesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs index 4b4f8b14b582..d6a7e999cfd3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -49,6 +49,11 @@ public partial class SqlManagementClient : ServiceClient, I /// public ServiceClientCredentials Credentials { get; private set; } + /// + /// The API version to use for the request. + /// + public string ApiVersion { get; private set; } + /// /// The subscription ID that identifies an Azure subscription. /// @@ -73,114 +78,119 @@ public partial class SqlManagementClient : ServiceClient, I public bool? GenerateClientRequestId { get; set; } /// - /// Gets the IRecoverableDatabasesOperations. + /// Gets the IBackupShortTermRetentionPoliciesOperations. /// - public virtual IRecoverableDatabasesOperations RecoverableDatabases { get; private set; } + public virtual IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IRestorableDroppedDatabasesOperations. + /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. /// - public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } + public virtual IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; private set; } /// - /// Gets the IServerConnectionPoliciesOperations. + /// Gets the IExtendedServerBlobAuditingPoliciesOperations. /// - public virtual IServerConnectionPoliciesOperations ServerConnectionPolicies { get; private set; } + public virtual IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; private set; } /// - /// Gets the IDatabaseThreatDetectionPoliciesOperations. + /// Gets the IServerBlobAuditingPoliciesOperations. /// - public virtual IDatabaseThreatDetectionPoliciesOperations DatabaseThreatDetectionPolicies { get; private set; } + public virtual IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; private set; } /// - /// Gets the IDataMaskingPoliciesOperations. + /// Gets the IDatabaseBlobAuditingPoliciesOperations. /// - public virtual IDataMaskingPoliciesOperations DataMaskingPolicies { get; private set; } + public virtual IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; private set; } /// - /// Gets the IDataMaskingRulesOperations. + /// Gets the IDataWarehouseUserActivitiesOperations. /// - public virtual IDataMaskingRulesOperations DataMaskingRules { get; private set; } + public virtual IDataWarehouseUserActivitiesOperations DataWarehouseUserActivities { get; private set; } /// - /// Gets the IFirewallRulesOperations. + /// Gets the IDatabaseAdvisorsOperations. /// - public virtual IFirewallRulesOperations FirewallRules { get; private set; } + public virtual IDatabaseAdvisorsOperations DatabaseAdvisors { get; private set; } /// - /// Gets the IGeoBackupPoliciesOperations. + /// Gets the IDatabaseAutomaticTuningOperations. /// - public virtual IGeoBackupPoliciesOperations GeoBackupPolicies { get; private set; } + public virtual IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; private set; } /// - /// Gets the IDatabasesOperations. + /// Gets the IDatabaseColumnsOperations. /// - public virtual IDatabasesOperations Databases { get; private set; } + public virtual IDatabaseColumnsOperations DatabaseColumns { get; private set; } /// - /// Gets the IElasticPoolsOperations. + /// Gets the IDatabaseExtensionsOperations. /// - public virtual IElasticPoolsOperations ElasticPools { get; private set; } + public virtual IDatabaseExtensionsOperations DatabaseExtensions { get; private set; } /// - /// Gets the IRecommendedElasticPoolsOperations. + /// Gets the IDatabaseOperations. /// - public virtual IRecommendedElasticPoolsOperations RecommendedElasticPools { get; private set; } + public virtual IDatabaseOperations DatabaseOperations { get; private set; } /// - /// Gets the IReplicationLinksOperations. + /// Gets the IDatabaseRecommendedActionsOperations. /// - public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } + public virtual IDatabaseRecommendedActionsOperations DatabaseRecommendedActions { get; private set; } /// - /// Gets the IServerCommunicationLinksOperations. + /// Gets the IDatabaseSchemasOperations. /// - public virtual IServerCommunicationLinksOperations ServerCommunicationLinks { get; private set; } + public virtual IDatabaseSchemasOperations DatabaseSchemas { get; private set; } /// - /// Gets the IServiceObjectivesOperations. + /// Gets the IDatabaseSecurityAlertPoliciesOperations. /// - public virtual IServiceObjectivesOperations ServiceObjectives { get; private set; } + public virtual IDatabaseSecurityAlertPoliciesOperations DatabaseSecurityAlertPolicies { get; private set; } /// - /// Gets the IElasticPoolActivitiesOperations. + /// Gets the IDatabaseTablesOperations. /// - public virtual IElasticPoolActivitiesOperations ElasticPoolActivities { get; private set; } + public virtual IDatabaseTablesOperations DatabaseTables { get; private set; } /// - /// Gets the IElasticPoolDatabaseActivitiesOperations. + /// Gets the IDatabaseUsagesOperations. /// - public virtual IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; private set; } + public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } /// - /// Gets the IServiceTierAdvisorsOperations. + /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// - public virtual IServiceTierAdvisorsOperations ServiceTierAdvisors { get; private set; } + public virtual IDatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } /// - /// Gets the ITransparentDataEncryptionsOperations. + /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. /// - public virtual ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; private set; } + public virtual IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; private set; } /// - /// Gets the ITransparentDataEncryptionActivitiesOperations. + /// Gets the IDatabaseVulnerabilityAssessmentsOperations. /// - public virtual ITransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities { get; private set; } + public virtual IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; private set; } /// - /// Gets the IServerUsagesOperations. + /// Gets the IDatabasesOperations. /// - public virtual IServerUsagesOperations ServerUsages { get; private set; } + public virtual IDatabasesOperations Databases { get; private set; } /// - /// Gets the IDatabaseUsagesOperations. + /// Gets the IDeletedServersOperations. /// - public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } + public virtual IDeletedServersOperations DeletedServers { get; private set; } /// - /// Gets the IDatabaseAutomaticTuningOperations. + /// Gets the IElasticPoolOperations. /// - public virtual IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; private set; } + public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } + + /// + /// Gets the IElasticPoolsOperations. + /// + public virtual IElasticPoolsOperations ElasticPools { get; private set; } /// /// Gets the IEncryptionProtectorsOperations. @@ -193,254 +203,259 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IFailoverGroupsOperations FailoverGroups { get; private set; } /// - /// Gets the IOperations. + /// Gets the IFirewallRulesOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IFirewallRulesOperations FirewallRules { get; private set; } /// - /// Gets the IServerKeysOperations. + /// Gets the IInstanceFailoverGroupsOperations. /// - public virtual IServerKeysOperations ServerKeys { get; private set; } + public virtual IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; private set; } /// - /// Gets the ISyncAgentsOperations. + /// Gets the IInstancePoolsOperations. /// - public virtual ISyncAgentsOperations SyncAgents { get; private set; } + public virtual IInstancePoolsOperations InstancePools { get; private set; } /// - /// Gets the ISubscriptionUsagesOperations. + /// Gets the IJobAgentsOperations. /// - public virtual ISubscriptionUsagesOperations SubscriptionUsages { get; private set; } + public virtual IJobAgentsOperations JobAgents { get; private set; } /// - /// Gets the IVirtualClustersOperations. + /// Gets the IJobCredentialsOperations. /// - public virtual IVirtualClustersOperations VirtualClusters { get; private set; } + public virtual IJobCredentialsOperations JobCredentials { get; private set; } /// - /// Gets the IVirtualNetworkRulesOperations. + /// Gets the IJobExecutionsOperations. /// - public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; } + public virtual IJobExecutionsOperations JobExecutions { get; private set; } /// - /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. + /// Gets the IJobStepExecutionsOperations. /// - public virtual IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; private set; } + public virtual IJobStepExecutionsOperations JobStepExecutions { get; private set; } /// - /// Gets the IExtendedServerBlobAuditingPoliciesOperations. + /// Gets the IJobStepsOperations. /// - public virtual IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; private set; } + public virtual IJobStepsOperations JobSteps { get; private set; } /// - /// Gets the IServerBlobAuditingPoliciesOperations. + /// Gets the IJobTargetExecutionsOperations. /// - public virtual IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; private set; } + public virtual IJobTargetExecutionsOperations JobTargetExecutions { get; private set; } /// - /// Gets the IDatabaseBlobAuditingPoliciesOperations. + /// Gets the IJobTargetGroupsOperations. /// - public virtual IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; private set; } + public virtual IJobTargetGroupsOperations JobTargetGroups { get; private set; } /// - /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IJobVersionsOperations. /// - public virtual IDatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } + public virtual IJobVersionsOperations JobVersions { get; private set; } /// - /// Gets the IDatabaseVulnerabilityAssessmentsOperations. + /// Gets the IJobsOperations. /// - public virtual IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; private set; } + public virtual IJobsOperations Jobs { get; private set; } /// - /// Gets the IJobAgentsOperations. + /// Gets the ILedgerDigestUploadsOperations. /// - public virtual IJobAgentsOperations JobAgents { get; private set; } + public virtual ILedgerDigestUploadsOperations LedgerDigestUploads { get; private set; } /// - /// Gets the IJobCredentialsOperations. + /// Gets the ICapabilitiesOperations. /// - public virtual IJobCredentialsOperations JobCredentials { get; private set; } + public virtual ICapabilitiesOperations Capabilities { get; private set; } /// - /// Gets the IJobExecutionsOperations. + /// Gets the ILongTermRetentionBackupsOperations. /// - public virtual IJobExecutionsOperations JobExecutions { get; private set; } + public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } /// - /// Gets the IJobsOperations. + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. /// - public virtual IJobsOperations Jobs { get; private set; } + public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } /// - /// Gets the IJobStepExecutionsOperations. + /// Gets the ILongTermRetentionPoliciesOperations. /// - public virtual IJobStepExecutionsOperations JobStepExecutions { get; private set; } + public virtual ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; private set; } /// - /// Gets the IJobStepsOperations. + /// Gets the IMaintenanceWindowOptionsOperations. /// - public virtual IJobStepsOperations JobSteps { get; private set; } + public virtual IMaintenanceWindowOptionsOperations MaintenanceWindowOptions { get; private set; } /// - /// Gets the IJobTargetExecutionsOperations. + /// Gets the IMaintenanceWindowsOperations. /// - public virtual IJobTargetExecutionsOperations JobTargetExecutions { get; private set; } + public virtual IMaintenanceWindowsOperations MaintenanceWindows { get; private set; } /// - /// Gets the IJobTargetGroupsOperations. + /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// - public virtual IJobTargetGroupsOperations JobTargetGroups { get; private set; } + public virtual IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IJobVersionsOperations. + /// Gets the IManagedDatabaseColumnsOperations. /// - public virtual IJobVersionsOperations JobVersions { get; private set; } + public virtual IManagedDatabaseColumnsOperations ManagedDatabaseColumns { get; private set; } /// - /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedDatabaseQueriesOperations. /// - public virtual IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; private set; } + public virtual IManagedDatabaseQueriesOperations ManagedDatabaseQueries { get; private set; } /// - /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedDatabaseRestoreDetailsOperations. /// - public virtual IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; private set; } + public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } /// - /// Gets the IServerAutomaticTuningOperations. + /// Gets the IManagedDatabaseSchemasOperations. /// - public virtual IServerAutomaticTuningOperations ServerAutomaticTuning { get; private set; } + public virtual IManagedDatabaseSchemasOperations ManagedDatabaseSchemas { get; private set; } /// - /// Gets the IServerDnsAliasesOperations. + /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. /// - public virtual IServerDnsAliasesOperations ServerDnsAliases { get; private set; } + public virtual IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; private set; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseSecurityEventsOperations. /// - public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } + public virtual IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; private set; } /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// Gets the IManagedDatabaseSensitivityLabelsOperations. /// - public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } + public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } /// - /// Gets the IRestorePointsOperations. + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. /// - public virtual IRestorePointsOperations RestorePoints { get; private set; } + public virtual IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; private set; } /// - /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseTablesOperations. /// - public virtual IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; private set; } + public virtual IManagedDatabaseTablesOperations ManagedDatabaseTables { get; private set; } /// - /// Gets the IManagedServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseTransparentDataEncryptionOperations. /// - public virtual IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; private set; } + public virtual IManagedDatabaseTransparentDataEncryptionOperations ManagedDatabaseTransparentDataEncryption { get; private set; } /// - /// Gets the ISensitivityLabelsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// - public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } + public virtual IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } /// - /// Gets the IManagedInstanceAdministratorsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. /// - public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } + public virtual IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; private set; } /// - /// Gets the IDatabaseOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. /// - public virtual IDatabaseOperations DatabaseOperations { get; private set; } + public virtual IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; private set; } /// - /// Gets the IElasticPoolOperations. + /// Gets the IManagedDatabasesOperations. /// - public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } + public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } /// - /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedInstanceAdministratorsOperations. /// - public virtual IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; private set; } + public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. /// - public virtual IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } + public virtual IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; private set; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedInstanceEncryptionProtectorsOperations. /// - public virtual IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; private set; } + public virtual IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; private set; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. + /// Gets the IManagedInstanceKeysOperations. /// - public virtual IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; private set; } + public virtual IManagedInstanceKeysOperations ManagedInstanceKeys { get; private set; } /// - /// Gets the IInstanceFailoverGroupsOperations. + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. /// - public virtual IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; private set; } + public virtual IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; private set; } /// - /// Gets the ITdeCertificatesOperations. + /// Gets the IManagedInstanceOperations. /// - public virtual ITdeCertificatesOperations TdeCertificates { get; private set; } + public virtual IManagedInstanceOperations ManagedInstanceOperations { get; private set; } /// - /// Gets the IManagedInstanceTdeCertificatesOperations. + /// Gets the IManagedInstancePrivateEndpointConnectionsOperations. /// - public virtual IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; private set; } + public virtual IManagedInstancePrivateEndpointConnectionsOperations ManagedInstancePrivateEndpointConnections { get; private set; } /// - /// Gets the IManagedInstanceKeysOperations. + /// Gets the IManagedInstancePrivateLinkResourcesOperations. /// - public virtual IManagedInstanceKeysOperations ManagedInstanceKeys { get; private set; } + public virtual IManagedInstancePrivateLinkResourcesOperations ManagedInstancePrivateLinkResources { get; private set; } /// - /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// Gets the IManagedInstanceTdeCertificatesOperations. /// - public virtual IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; private set; } + public virtual IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; private set; } /// - /// Gets the IRecoverableManagedDatabasesOperations. + /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. /// - public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } + public virtual IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; private set; } /// - /// Gets the IBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedInstancesOperations. /// - public virtual IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; private set; } + public virtual IManagedInstancesOperations ManagedInstances { get; private set; } /// - /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. + /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. /// - public virtual IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; private set; } + public virtual IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IServerVulnerabilityAssessmentsOperations. + /// Gets the IManagedServerSecurityAlertPoliciesOperations. /// - public virtual IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; private set; } + public virtual IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; private set; } /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// Gets the IOperations. /// - public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the IInstancePoolsOperations. + /// Gets the IOperationsHealthOperations. /// - public virtual IInstancePoolsOperations InstancePools { get; private set; } + public virtual IOperationsHealthOperations OperationsHealth { get; private set; } /// - /// Gets the IUsagesOperations. + /// Gets the IOutboundFirewallRulesOperations. /// - public virtual IUsagesOperations Usages { get; private set; } + public virtual IOutboundFirewallRulesOperations OutboundFirewallRules { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } /// /// Gets the IPrivateLinkResourcesOperations. @@ -448,84 +463,84 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } /// - /// Gets the IServersOperations. + /// Gets the IRecoverableManagedDatabasesOperations. /// - public virtual IServersOperations Servers { get; private set; } + public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } /// - /// Gets the ICapabilitiesOperations. + /// Gets the IReplicationLinksOperations. /// - public virtual ICapabilitiesOperations Capabilities { get; private set; } + public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } /// - /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// Gets the IRestorableDroppedDatabasesOperations. /// - public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } + public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } /// - /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// Gets the IRestorableDroppedManagedDatabasesOperations. /// - public virtual IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; private set; } + public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } /// - /// Gets the IWorkloadGroupsOperations. + /// Gets the IRestorePointsOperations. /// - public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } + public virtual IRestorePointsOperations RestorePoints { get; private set; } /// - /// Gets the IWorkloadClassifiersOperations. + /// Gets the ISensitivityLabelsOperations. /// - public virtual IWorkloadClassifiersOperations WorkloadClassifiers { get; private set; } + public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } /// - /// Gets the IManagedInstanceOperations. + /// Gets the IRecommendedSensitivityLabelsOperations. /// - public virtual IManagedInstanceOperations ManagedInstanceOperations { get; private set; } + public virtual IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; private set; } /// - /// Gets the IServerAzureADAdministratorsOperations. + /// Gets the IServerAdvisorsOperations. /// - public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } + public virtual IServerAdvisorsOperations ServerAdvisors { get; private set; } /// - /// Gets the ISyncGroupsOperations. + /// Gets the IServerAutomaticTuningOperations. /// - public virtual ISyncGroupsOperations SyncGroups { get; private set; } + public virtual IServerAutomaticTuningOperations ServerAutomaticTuning { get; private set; } /// - /// Gets the ISyncMembersOperations. + /// Gets the IServerAzureADAdministratorsOperations. /// - public virtual ISyncMembersOperations SyncMembers { get; private set; } + public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } /// - /// Gets the IImportExportOperations. + /// Gets the IServerAzureADOnlyAuthenticationsOperations. /// - public virtual IImportExportOperations ImportExport { get; private set; } + public virtual IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; private set; } /// - /// Gets the IManagedDatabasesOperations. + /// Gets the IServerDevOpsAuditSettingsOperations. /// - public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } + public virtual IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; private set; } /// - /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// Gets the IServerDnsAliasesOperations. /// - public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } + public virtual IServerDnsAliasesOperations ServerDnsAliases { get; private set; } /// - /// Gets the IServerAzureADOnlyAuthenticationsOperations. + /// Gets the IServerKeysOperations. /// - public virtual IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; private set; } + public virtual IServerKeysOperations ServerKeys { get; private set; } /// - /// Gets the IManagedInstancesOperations. + /// Gets the IServerOperations. /// - public virtual IManagedInstancesOperations ManagedInstances { get; private set; } + public virtual IServerOperations ServerOperations { get; private set; } /// - /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. + /// Gets the IServerSecurityAlertPoliciesOperations. /// - public virtual IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; private set; } + public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } /// /// Gets the IServerTrustGroupsOperations. @@ -533,24 +548,74 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IServerTrustGroupsOperations ServerTrustGroups { get; private set; } /// - /// Gets the IServerDevOpsAuditSettingsOperations. + /// Gets the IServerVulnerabilityAssessmentsOperations. /// - public virtual IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; private set; } + public virtual IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; private set; } /// - /// Gets the ILongTermRetentionBackupsOperations. + /// Gets the IServersOperations. /// - public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } + public virtual IServersOperations Servers { get; private set; } /// - /// Gets the ILongTermRetentionPoliciesOperations. + /// Gets the ISqlAgentOperations. /// - public virtual ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; private set; } + public virtual ISqlAgentOperations SqlAgent { get; private set; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the ISubscriptionUsagesOperations. /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + public virtual ISubscriptionUsagesOperations SubscriptionUsages { get; private set; } + + /// + /// Gets the ISyncAgentsOperations. + /// + public virtual ISyncAgentsOperations SyncAgents { get; private set; } + + /// + /// Gets the ISyncGroupsOperations. + /// + public virtual ISyncGroupsOperations SyncGroups { get; private set; } + + /// + /// Gets the ISyncMembersOperations. + /// + public virtual ISyncMembersOperations SyncMembers { get; private set; } + + /// + /// Gets the ITdeCertificatesOperations. + /// + public virtual ITdeCertificatesOperations TdeCertificates { get; private set; } + + /// + /// Gets the ITimeZonesOperations. + /// + public virtual ITimeZonesOperations TimeZones { get; private set; } + + /// + /// Gets the ITransparentDataEncryptionsOperations. + /// + public virtual ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; private set; } + + /// + /// Gets the IVirtualClustersOperations. + /// + public virtual IVirtualClustersOperations VirtualClusters { get; private set; } + + /// + /// Gets the IVirtualNetworkRulesOperations. + /// + public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; } + + /// + /// Gets the IWorkloadClassifiersOperations. + /// + public virtual IWorkloadClassifiersOperations WorkloadClassifiers { get; private set; } + + /// + /// Gets the IWorkloadGroupsOperations. + /// + public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } /// /// Initializes a new instance of the SqlManagementClient class. @@ -793,103 +858,116 @@ public SqlManagementClient(System.Uri baseUri, ServiceClientCredentials credenti /// private void Initialize() { - RecoverableDatabases = new RecoverableDatabasesOperations(this); - RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); - ServerConnectionPolicies = new ServerConnectionPoliciesOperations(this); - DatabaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesOperations(this); - DataMaskingPolicies = new DataMaskingPoliciesOperations(this); - DataMaskingRules = new DataMaskingRulesOperations(this); - FirewallRules = new FirewallRulesOperations(this); - GeoBackupPolicies = new GeoBackupPoliciesOperations(this); - Databases = new DatabasesOperations(this); - ElasticPools = new ElasticPoolsOperations(this); - RecommendedElasticPools = new RecommendedElasticPoolsOperations(this); - ReplicationLinks = new ReplicationLinksOperations(this); - ServerCommunicationLinks = new ServerCommunicationLinksOperations(this); - ServiceObjectives = new ServiceObjectivesOperations(this); - ElasticPoolActivities = new ElasticPoolActivitiesOperations(this); - ElasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesOperations(this); - ServiceTierAdvisors = new ServiceTierAdvisorsOperations(this); - TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); - TransparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesOperations(this); - ServerUsages = new ServerUsagesOperations(this); - DatabaseUsages = new DatabaseUsagesOperations(this); - DatabaseAutomaticTuning = new DatabaseAutomaticTuningOperations(this); - EncryptionProtectors = new EncryptionProtectorsOperations(this); - FailoverGroups = new FailoverGroupsOperations(this); - Operations = new Operations(this); - ServerKeys = new ServerKeysOperations(this); - SyncAgents = new SyncAgentsOperations(this); - SubscriptionUsages = new SubscriptionUsagesOperations(this); - VirtualClusters = new VirtualClustersOperations(this); - VirtualNetworkRules = new VirtualNetworkRulesOperations(this); + BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); ExtendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesOperations(this); ExtendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesOperations(this); ServerBlobAuditingPolicies = new ServerBlobAuditingPoliciesOperations(this); DatabaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesOperations(this); + DataWarehouseUserActivities = new DataWarehouseUserActivitiesOperations(this); + DatabaseAdvisors = new DatabaseAdvisorsOperations(this); + DatabaseAutomaticTuning = new DatabaseAutomaticTuningOperations(this); + DatabaseColumns = new DatabaseColumnsOperations(this); + DatabaseExtensions = new DatabaseExtensionsOperations(this); + DatabaseOperations = new DatabaseOperations(this); + DatabaseRecommendedActions = new DatabaseRecommendedActionsOperations(this); + DatabaseSchemas = new DatabaseSchemasOperations(this); + DatabaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesOperations(this); + DatabaseTables = new DatabaseTablesOperations(this); + DatabaseUsages = new DatabaseUsagesOperations(this); DatabaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); + DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); DatabaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsOperations(this); + Databases = new DatabasesOperations(this); + DeletedServers = new DeletedServersOperations(this); + ElasticPoolOperations = new ElasticPoolOperations(this); + ElasticPools = new ElasticPoolsOperations(this); + EncryptionProtectors = new EncryptionProtectorsOperations(this); + FailoverGroups = new FailoverGroupsOperations(this); + FirewallRules = new FirewallRulesOperations(this); + InstanceFailoverGroups = new InstanceFailoverGroupsOperations(this); + InstancePools = new InstancePoolsOperations(this); JobAgents = new JobAgentsOperations(this); JobCredentials = new JobCredentialsOperations(this); JobExecutions = new JobExecutionsOperations(this); - Jobs = new JobsOperations(this); JobStepExecutions = new JobStepExecutionsOperations(this); JobSteps = new JobStepsOperations(this); JobTargetExecutions = new JobTargetExecutionsOperations(this); JobTargetGroups = new JobTargetGroupsOperations(this); JobVersions = new JobVersionsOperations(this); + Jobs = new JobsOperations(this); + LedgerDigestUploads = new LedgerDigestUploadsOperations(this); + Capabilities = new CapabilitiesOperations(this); + LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); + LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); + LongTermRetentionPolicies = new LongTermRetentionPoliciesOperations(this); + MaintenanceWindowOptions = new MaintenanceWindowOptionsOperations(this); + MaintenanceWindows = new MaintenanceWindowsOperations(this); ManagedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesOperations(this); - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(this); - ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); - ServerDnsAliases = new ServerDnsAliasesOperations(this); - ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); - RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); - RestorePoints = new RestorePointsOperations(this); + ManagedDatabaseColumns = new ManagedDatabaseColumnsOperations(this); + ManagedDatabaseQueries = new ManagedDatabaseQueriesOperations(this); + ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); + ManagedDatabaseSchemas = new ManagedDatabaseSchemasOperations(this); ManagedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesOperations(this); - ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); - SensitivityLabels = new SensitivityLabelsOperations(this); - ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); - DatabaseOperations = new DatabaseOperations(this); - ElasticPoolOperations = new ElasticPoolOperations(this); - DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); + ManagedDatabaseSecurityEvents = new ManagedDatabaseSecurityEventsOperations(this); + ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); + ManagedDatabaseRecommendedSensitivityLabels = new ManagedDatabaseRecommendedSensitivityLabelsOperations(this); + ManagedDatabaseTables = new ManagedDatabaseTablesOperations(this); + ManagedDatabaseTransparentDataEncryption = new ManagedDatabaseTransparentDataEncryptionOperations(this); ManagedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); ManagedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansOperations(this); ManagedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsOperations(this); - InstanceFailoverGroups = new InstanceFailoverGroupsOperations(this); - TdeCertificates = new TdeCertificatesOperations(this); - ManagedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesOperations(this); - ManagedInstanceKeys = new ManagedInstanceKeysOperations(this); + ManagedDatabases = new ManagedDatabasesOperations(this); + ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); + ManagedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsOperations(this); ManagedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsOperations(this); - RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); - BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); - ManagedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsOperations(this); - ServerVulnerabilityAssessments = new ServerVulnerabilityAssessmentsOperations(this); - ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); - InstancePools = new InstancePoolsOperations(this); - Usages = new UsagesOperations(this); - PrivateLinkResources = new PrivateLinkResourcesOperations(this); - Servers = new ServersOperations(this); - Capabilities = new CapabilitiesOperations(this); - LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); + ManagedInstanceKeys = new ManagedInstanceKeysOperations(this); ManagedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesOperations(this); - WorkloadGroups = new WorkloadGroupsOperations(this); - WorkloadClassifiers = new WorkloadClassifiersOperations(this); ManagedInstanceOperations = new ManagedInstanceOperations(this); + ManagedInstancePrivateEndpointConnections = new ManagedInstancePrivateEndpointConnectionsOperations(this); + ManagedInstancePrivateLinkResources = new ManagedInstancePrivateLinkResourcesOperations(this); + ManagedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesOperations(this); + ManagedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsOperations(this); + ManagedInstances = new ManagedInstancesOperations(this); + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(this); + ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); + Operations = new Operations(this); + OperationsHealth = new OperationsHealthOperations(this); + OutboundFirewallRules = new OutboundFirewallRulesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); + ReplicationLinks = new ReplicationLinksOperations(this); + RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); + RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); + RestorePoints = new RestorePointsOperations(this); + SensitivityLabels = new SensitivityLabelsOperations(this); + RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); + ServerAdvisors = new ServerAdvisorsOperations(this); + ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(this); - SyncGroups = new SyncGroupsOperations(this); - SyncMembers = new SyncMembersOperations(this); - ImportExport = new ImportExportOperations(this); - ManagedDatabases = new ManagedDatabasesOperations(this); - ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); ServerAzureADOnlyAuthentications = new ServerAzureADOnlyAuthenticationsOperations(this); - ManagedInstances = new ManagedInstancesOperations(this); - ManagedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsOperations(this); - ServerTrustGroups = new ServerTrustGroupsOperations(this); ServerDevOpsAuditSettings = new ServerDevOpsAuditSettingsOperations(this); - LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); - LongTermRetentionPolicies = new LongTermRetentionPoliciesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + ServerDnsAliases = new ServerDnsAliasesOperations(this); + ServerKeys = new ServerKeysOperations(this); + ServerOperations = new ServerOperations(this); + ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); + ServerTrustGroups = new ServerTrustGroupsOperations(this); + ServerVulnerabilityAssessments = new ServerVulnerabilityAssessmentsOperations(this); + Servers = new ServersOperations(this); + SqlAgent = new SqlAgentOperations(this); + SubscriptionUsages = new SubscriptionUsagesOperations(this); + SyncAgents = new SyncAgentsOperations(this); + SyncGroups = new SyncGroupsOperations(this); + SyncMembers = new SyncMembersOperations(this); + TdeCertificates = new TdeCertificatesOperations(this); + TimeZones = new TimeZonesOperations(this); + TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); + VirtualClusters = new VirtualClustersOperations(this); + VirtualNetworkRules = new VirtualNetworkRulesOperations(this); + WorkloadClassifiers = new WorkloadClassifiersOperations(this); + WorkloadGroups = new WorkloadGroupsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-02-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs index bb1f5687eef5..857eeaafa52e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs @@ -87,7 +87,10 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -96,7 +99,6 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -106,9 +108,9 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -216,7 +218,7 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -279,7 +281,10 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -289,7 +294,6 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("locationName", locationName); tracingParameters.Add("usageName", usageName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -300,9 +304,9 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) _url = _url.Replace("{usageName}", System.Uri.EscapeDataString(usageName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -583,7 +587,7 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs index 7a923e9f4ef5..bcf92439308b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs @@ -102,7 +102,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal SyncAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("syncAgentName", syncAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -354,7 +356,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -364,7 +369,6 @@ internal SyncAgentsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -375,9 +379,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -485,7 +489,7 @@ internal SyncAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -556,7 +560,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -567,7 +574,6 @@ internal SyncAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("syncAgentName", syncAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateKey", tracingParameters); } @@ -579,9 +585,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -760,7 +766,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -771,7 +780,6 @@ internal SyncAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("syncAgentName", syncAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListLinkedDatabases", tracingParameters); } @@ -783,9 +791,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -893,7 +901,7 @@ internal SyncAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -971,7 +979,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -983,7 +994,6 @@ internal SyncAgentsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("syncAgentName", syncAgentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -995,9 +1005,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1197,7 +1207,10 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1208,7 +1221,6 @@ internal SyncAgentsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("syncAgentName", syncAgentName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1220,9 +1232,9 @@ internal SyncAgentsOperations(SqlManagementClient client) _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1485,7 +1497,7 @@ internal SyncAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1658,7 +1670,7 @@ internal SyncAgentsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs index 71d69dcc0a8f..520ce5731cd9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs @@ -87,7 +87,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -96,7 +99,6 @@ internal SyncGroupsOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSyncDatabaseIds", tracingParameters); } @@ -106,9 +108,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -216,7 +218,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -323,7 +325,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -335,7 +340,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListHubSchemas", tracingParameters); } @@ -348,9 +352,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -458,7 +462,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -561,7 +565,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -577,7 +584,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("endTime", endTime); tracingParameters.Add("type", type); tracingParameters.Add("continuationToken", continuationToken); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListLogs", tracingParameters); } @@ -606,9 +612,9 @@ internal SyncGroupsOperations(SqlManagementClient client) { _queryParameters.Add(string.Format("continuationToken={0}", System.Uri.EscapeDataString(continuationToken))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -716,7 +722,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -791,7 +797,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -803,7 +812,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CancelSync", tracingParameters); } @@ -816,9 +824,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -983,7 +991,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -995,7 +1006,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "TriggerSync", tracingParameters); } @@ -1008,9 +1018,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1178,7 +1188,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1190,7 +1203,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -1203,9 +1215,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1477,7 +1489,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1488,7 +1503,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -1500,9 +1514,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1610,7 +1624,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1685,7 +1699,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1697,7 +1714,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshHubSchema", tracingParameters); } @@ -1710,9 +1726,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1883,11 +1899,18 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1900,7 +1923,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1913,9 +1935,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2122,7 +2144,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2134,7 +2159,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -2147,9 +2171,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2324,7 +2348,10 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2337,7 +2364,6 @@ internal SyncGroupsOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -2350,9 +2376,9 @@ internal SyncGroupsOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2639,7 +2665,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2812,7 +2838,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2985,7 +3011,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3158,7 +3184,7 @@ internal SyncGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs index 0b4acf9c3534..548bbc064caa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs @@ -116,7 +116,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -129,7 +132,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -143,9 +145,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -433,7 +435,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -445,7 +450,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySyncGroup", tracingParameters); } @@ -458,9 +462,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -568,7 +572,7 @@ internal SyncMembersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -653,7 +657,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -666,7 +673,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListMemberSchemas", tracingParameters); } @@ -680,9 +686,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -790,7 +796,7 @@ internal SyncMembersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -914,7 +920,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -928,7 +937,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -942,9 +950,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1158,7 +1166,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1171,7 +1182,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1185,9 +1195,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1369,7 +1379,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1383,7 +1396,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1397,9 +1409,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1595,7 +1607,10 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1608,7 +1623,6 @@ internal SyncMembersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("syncGroupName", syncGroupName); tracingParameters.Add("syncMemberName", syncMemberName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshMemberSchema", tracingParameters); } @@ -1622,9 +1636,9 @@ internal SyncMembersOperations(SqlManagementClient client) _url = _url.Replace("{syncMemberName}", System.Uri.EscapeDataString(syncMemberName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1887,7 +1901,7 @@ internal SyncMembersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2060,7 +2074,7 @@ internal SyncMembersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs index 9b4ebb376440..68540ca45465 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs @@ -129,7 +129,10 @@ internal TdeCertificatesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -140,7 +143,6 @@ internal TdeCertificatesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } @@ -151,9 +153,9 @@ internal TdeCertificatesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs new file mode 100644 index 000000000000..d6d50a4d3a56 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs @@ -0,0 +1,607 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimeZonesOperations operations. + /// + internal partial class TimeZonesOperations : IServiceOperations, ITimeZonesOperations + { + /// + /// Initializes a new instance of the TimeZonesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TimeZonesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string locationName, string timeZoneId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (timeZoneId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "timeZoneId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("timeZoneId", timeZoneId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{timeZoneId}", System.Uri.EscapeDataString(timeZoneId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs new file mode 100644 index 000000000000..c550a15e1b6b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TimeZonesOperations. + /// + public static partial class TimeZonesOperationsExtensions + { + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static IPage ListByLocation(this ITimeZonesOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this ITimeZonesOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static TimeZone Get(this ITimeZonesOperations operations, string locationName, string timeZoneId) + { + return operations.GetAsync(locationName, timeZoneId).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITimeZonesOperations operations, string locationName, string timeZoneId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, timeZoneId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this ITimeZonesOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this ITimeZonesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs index 5b30e4f81873..c614382b00e6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs @@ -51,7 +51,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,12 +61,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. - /// - /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// Headers that will be added to request. @@ -89,12 +85,221 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string tdeName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").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("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a logical database's transparent data encryption configuration. + /// + /// + /// 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 logical database for which the security alert policy is + /// defined. + /// + /// + /// The database transparent data encryption. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -111,8 +316,19 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + string tdeName = "current"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -120,27 +336,26 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + tracingParameters.Add("tdeName", tdeName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").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("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -206,7 +421,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -241,7 +456,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -254,7 +469,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -272,7 +487,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -292,7 +507,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -302,7 +517,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// Headers that will be added to request. @@ -325,12 +541,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -343,8 +555,14 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -352,27 +570,197 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption").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("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -466,7 +854,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -479,7 +867,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs index af93ae4da712..d880074daa32 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class TransparentDataEncryptionsOperationsExtensions { /// - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -35,20 +35,69 @@ public static partial class TransparentDataEncryptionsOperationsExtensions /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. + /// + public static LogicalDatabaseTransparentDataEncryption Get(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a logical database's transparent data encryption. + /// + /// + /// 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 logical database for which the transparent data encryption + /// is defined. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a logical database's transparent data encryption configuration. + /// + /// + /// 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 logical database for which the security alert policy is + /// defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// - public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters) + public static LogicalDatabaseTransparentDataEncryption CreateOrUpdate(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters) { return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or updates a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// /// /// The operations group for this extension method. @@ -61,17 +110,16 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. + /// The name of the logical database for which the security alert policy is + /// defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -80,7 +128,7 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -93,15 +141,16 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// - public static TransparentDataEncryption Get(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -114,14 +163,49 @@ public static TransparentDataEncryption Get(this ITransparentDataEncryptionsOper /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// The cancellation token. /// - public static async Task GetAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ITransparentDataEncryptionsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this ITransparentDataEncryptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs index 73d877d3653b..f5eaa434748a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs @@ -50,6 +50,204 @@ internal VirtualClustersOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } + /// + /// Synchronizes the DNS server settings used by the managed instances inside + /// the given virtual cluster. + /// + /// + /// 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 virtual cluster. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateDnsServersWithHttpMessagesAsync(string resourceGroupName, string virtualClusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualClusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualClusterName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("virtualClusterName", virtualClusterName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDnsServers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}/updateManagedInstanceDnsServers").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualClusterName}", System.Uri.EscapeDataString(virtualClusterName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets a list of all virtualClusters in the subscription. /// @@ -80,7 +278,10 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -88,7 +289,6 @@ internal VirtualClustersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -97,9 +297,9 @@ internal VirtualClustersOperations(SqlManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -207,7 +407,7 @@ internal VirtualClustersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -264,7 +464,10 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -273,7 +476,6 @@ internal VirtualClustersOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -283,9 +485,9 @@ internal VirtualClustersOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -393,7 +595,7 @@ internal VirtualClustersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -457,7 +659,10 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -467,7 +672,6 @@ internal VirtualClustersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("virtualClusterName", virtualClusterName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -478,9 +682,9 @@ internal VirtualClustersOperations(SqlManagementClient client) _url = _url.Replace("{virtualClusterName}", System.Uri.EscapeDataString(virtualClusterName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -641,7 +845,7 @@ internal VirtualClustersOperations(SqlManagementClient client) /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. @@ -698,7 +902,10 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -708,7 +915,6 @@ internal VirtualClustersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("virtualClusterName", virtualClusterName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -719,9 +925,9 @@ internal VirtualClustersOperations(SqlManagementClient client) _url = _url.Replace("{virtualClusterName}", System.Uri.EscapeDataString(virtualClusterName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -841,7 +1047,7 @@ internal VirtualClustersOperations(SqlManagementClient client) /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// Headers that will be added to request. @@ -882,7 +1088,10 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -893,7 +1102,6 @@ internal VirtualClustersOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("virtualClusterName", virtualClusterName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -904,9 +1112,9 @@ internal VirtualClustersOperations(SqlManagementClient client) _url = _url.Replace("{virtualClusterName}", System.Uri.EscapeDataString(virtualClusterName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1193,7 +1401,7 @@ internal VirtualClustersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1366,7 +1574,7 @@ internal VirtualClustersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs index 473eec8ddc00..899ad5285382 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs @@ -21,6 +21,50 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class VirtualClustersOperationsExtensions { + /// + /// Synchronizes the DNS server settings used by the managed instances inside + /// the given virtual cluster. + /// + /// + /// 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 virtual cluster. + /// + public static UpdateManagedInstanceDnsServersOperation UpdateDnsServers(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName) + { + return operations.UpdateDnsServersAsync(resourceGroupName, virtualClusterName).GetAwaiter().GetResult(); + } + + /// + /// Synchronizes the DNS server settings used by the managed instances inside + /// the given virtual cluster. + /// + /// + /// 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 virtual cluster. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDnsServersAsync(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateDnsServersWithHttpMessagesAsync(resourceGroupName, virtualClusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of all virtualClusters in the subscription. /// @@ -180,7 +224,7 @@ public static void Delete(this IVirtualClustersOperations operations, string res /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// public static VirtualCluster Update(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters) { @@ -201,7 +245,7 @@ public static VirtualCluster Update(this IVirtualClustersOperations operations, /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The cancellation token. @@ -267,7 +311,7 @@ public static void BeginDelete(this IVirtualClustersOperations operations, strin /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// public static VirtualCluster BeginUpdate(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters) { @@ -288,7 +332,7 @@ public static VirtualCluster BeginUpdate(this IVirtualClustersOperations operati /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The cancellation token. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs index cfc3d41df255..a0137c2c723e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs @@ -102,7 +102,10 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,7 +116,6 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -125,9 +127,9 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -354,7 +356,10 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -364,7 +369,6 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } @@ -375,9 +379,9 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -485,7 +489,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -567,7 +571,10 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -579,7 +586,6 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -591,9 +597,9 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -793,7 +799,10 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -804,7 +813,6 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -816,9 +824,9 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1081,7 +1089,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs index 3aca3cda1e20..0d12976bfb53 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs @@ -116,7 +116,10 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -129,7 +132,6 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); tracingParameters.Add("workloadClassifierName", workloadClassifierName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -143,9 +145,9 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _url = _url.Replace("{workloadClassifierName}", System.Uri.EscapeDataString(workloadClassifierName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -398,7 +400,10 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -410,7 +415,6 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByWorkloadGroup", tracingParameters); } @@ -423,9 +427,9 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _url = _url.Replace("{workloadGroupName}", System.Uri.EscapeDataString(workloadGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -533,7 +537,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -629,7 +633,10 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -643,7 +650,6 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) tracingParameters.Add("workloadGroupName", workloadGroupName); tracingParameters.Add("workloadClassifierName", workloadClassifierName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -657,9 +663,9 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _url = _url.Replace("{workloadClassifierName}", System.Uri.EscapeDataString(workloadClassifierName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -873,7 +879,10 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -886,7 +895,6 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); tracingParameters.Add("workloadClassifierName", workloadClassifierName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -900,9 +908,9 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _url = _url.Replace("{workloadClassifierName}", System.Uri.EscapeDataString(workloadClassifierName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1165,7 +1173,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs index 186476f74931..ef38daf2182a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs @@ -109,7 +109,10 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,7 +124,6 @@ internal WorkloadGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -134,9 +136,9 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _url = _url.Replace("{workloadGroupName}", System.Uri.EscapeDataString(workloadGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -376,7 +378,10 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -387,7 +392,6 @@ internal WorkloadGroupsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } @@ -399,9 +403,9 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -509,7 +513,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -598,7 +602,10 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -611,7 +618,6 @@ internal WorkloadGroupsOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -624,9 +630,9 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _url = _url.Replace("{workloadGroupName}", System.Uri.EscapeDataString(workloadGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -833,7 +839,10 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -845,7 +854,6 @@ internal WorkloadGroupsOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("workloadGroupName", workloadGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -858,9 +866,9 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _url = _url.Replace("{workloadGroupName}", System.Uri.EscapeDataString(workloadGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1123,7 +1131,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) {