diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs index e3101c5c1b67..f9ab0f9303f3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs @@ -106,7 +106,7 @@ internal DatabaseExtensionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -326,7 +326,7 @@ internal DatabaseExtensionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -547,7 +547,7 @@ internal DatabaseExtensionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 b276a6a2afea..1d5fa4896d78 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,7 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -290,7 +290,7 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 3dafbdc792d2..2e8314d4d366 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs @@ -102,7 +102,7 @@ internal DatabaseUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 26357fb31fc7..309970e283d2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs @@ -480,6 +480,8 @@ internal DatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// /// /// Headers that will be added to request. /// @@ -501,7 +503,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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -515,7 +517,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -525,6 +527,7 @@ internal DatabasesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("skipToken", skipToken); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); @@ -536,6 +539,10 @@ internal DatabasesOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -717,7 +724,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1005,7 +1012,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1157,58 +1164,6 @@ internal DatabasesOperations(SqlManagementClient client) return _result; } - /// - /// Pauses a database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database to be paused. - /// - /// - /// The headers that will be added to request. - /// - /// - /// 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. /// @@ -1284,7 +1239,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1434,6 +1389,58 @@ internal DatabasesOperations(SqlManagementClient client) return _result; } + /// + /// Pauses a database. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database to be paused. + /// + /// + /// The headers that will be added to request. + /// + /// + /// 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); + } + /// /// Upgrades a data warehouse. /// @@ -1520,7 +1527,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1782,7 +1789,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2008,7 +2015,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2201,7 +2208,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2361,7 +2368,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2371,7 +2378,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. @@ -2382,9 +2393,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 /// @@ -2394,7 +2402,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) { @@ -2412,7 +2420,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2423,18 +2431,23 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("replicaType", replicaType); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - 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 (replicaType != null) + { + _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2532,31 +2545,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); @@ -2565,7 +2560,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Resumes a database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2575,7 +2570,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 paused. /// /// /// Headers that will be added to request. @@ -2598,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> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2616,7 +2611,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2629,11 +2624,11 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResume", 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}/resume").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)); @@ -2769,7 +2764,7 @@ internal DatabasesOperations(SqlManagementClient client) } /// - /// Failovers a database. + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2779,11 +2774,7 @@ internal DatabasesOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' + /// The name of the database to be resumed. /// /// /// Headers that will be added to request. @@ -2794,6 +2785,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 /// @@ -2803,7 +2797,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> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2821,7 +2815,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2832,23 +2826,18 @@ internal DatabasesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("replicaType", replicaType); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", 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}/failover").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (replicaType != null) - { - _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2946,13 +2935,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); @@ -3009,7 +3016,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3206,7 +3213,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3428,7 +3435,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 010097369b8a..46e86c427642 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs @@ -138,9 +138,11 @@ public static IEnumerable ListMetricDefinitions(this IDatabase /// /// The name of the server. /// - public static IPage ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static IPage ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName, string skipToken = default(string)) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName, skipToken).GetAwaiter().GetResult(); } /// @@ -156,12 +158,14 @@ public static IPage ListByServer(this IDatabasesOperations operations, /// /// The name of the server. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, skipToken, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -417,7 +421,7 @@ public static IPage ListByElasticPool(this IDatabasesOperations operat } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -430,15 +434,19 @@ public static IPage ListByElasticPool(this IDatabasesOperations operat /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database to failover. /// - public static Database Pause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + public static void Failover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) { - return operations.PauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + operations.FailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -451,21 +459,22 @@ public static Database Pause(this IDatabasesOperations operations, string resour /// 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' /// /// /// The cancellation token. /// - public static async Task PauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task FailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Resumes a database. + /// Gets a list of inaccessible databases in a logical server /// /// /// The operations group for this extension method. @@ -477,16 +486,13 @@ public static Database Pause(this IDatabasesOperations operations, string resour /// /// The name of the server. /// - /// - /// The name of the database to be resumed. - /// - public static Database Resume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListInaccessibleByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName) { - return operations.ResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.ListInaccessibleByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Resumes a database. + /// Gets a list of inaccessible databases in a logical server /// /// /// The operations group for this extension method. @@ -498,22 +504,19 @@ public static Database Resume(this IDatabasesOperations operations, string resou /// /// The name of the server. /// - /// - /// The name of the database to be resumed. - /// /// /// The cancellation token. /// - public static async Task ResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListInaccessibleByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListInaccessibleByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Failovers a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -526,19 +529,15 @@ public static Database Resume(this IDatabasesOperations operations, string resou /// 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 name of the database to be paused. /// - public static void Failover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) + public static Database Pause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - operations.FailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); + return operations.PauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Failovers a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -551,22 +550,21 @@ public static Database Resume(this IDatabasesOperations operations, string resou /// 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 name of the database to be paused. /// /// /// The cancellation token. /// - public static async Task FailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.PauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets a list of inaccessible databases in a logical server + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -578,13 +576,16 @@ public static Database Resume(this IDatabasesOperations operations, string resou /// /// The name of the server. /// - public static IPage ListInaccessibleByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the database to be resumed. + /// + public static Database Resume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.ListInaccessibleByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.ResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a list of inaccessible databases in a logical server + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -596,12 +597,15 @@ public static IPage ListInaccessibleByServer(this IDatabasesOperations /// /// The name of the server. /// + /// + /// The name of the database to be resumed. + /// /// /// The cancellation token. /// - public static async Task> ListInaccessibleByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListInaccessibleByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -965,7 +969,7 @@ public static Database BeginUpdate(this IDatabasesOperations operations, string } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -978,15 +982,19 @@ public static Database BeginUpdate(this IDatabasesOperations operations, string /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database to failover. /// - public static Database BeginPause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + public static void BeginFailover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) { - return operations.BeginPauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + operations.BeginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); } /// - /// Pauses a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -999,21 +1007,22 @@ public static Database BeginPause(this IDatabasesOperations operations, string r /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' /// /// /// The cancellation token. /// - public static async Task BeginPauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginFailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Resumes a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -1026,15 +1035,15 @@ public static Database BeginPause(this IDatabasesOperations operations, string r /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database to be paused. /// - public static Database BeginResume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static Database BeginPause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.BeginResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.BeginPauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Resumes a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -1047,21 +1056,21 @@ public static Database BeginResume(this IDatabasesOperations operations, string /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database to be paused. /// /// /// The cancellation token. /// - public static async Task BeginResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginPauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Failovers a database. + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -1074,19 +1083,15 @@ public static Database BeginResume(this IDatabasesOperations operations, string /// 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 name of the database to be resumed. /// - public static void BeginFailover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) + public static Database BeginResume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - operations.BeginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); + return operations.BeginResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Failovers a database. + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -1099,18 +1104,17 @@ public static Database BeginResume(this IDatabasesOperations operations, string /// 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 name of the database to be resumed. /// /// /// The cancellation token. /// - public static async Task BeginFailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// 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 dbad0bfa9ef0..277dc9cb311c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs @@ -98,6 +98,8 @@ public partial interface IDatabasesOperations /// /// The name of the server. /// + /// + /// /// /// The headers that will be added to request. /// @@ -113,7 +115,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a database. /// @@ -268,7 +270,7 @@ public partial interface IDatabasesOperations /// Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Pauses a database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can @@ -279,7 +281,11 @@ public partial interface IDatabasesOperations /// 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' /// /// /// The headers that will be added to request. @@ -290,15 +296,12 @@ public partial interface IDatabasesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Resumes a database. + /// Gets a list of inaccessible databases in a logical server /// /// /// The name of the resource group that contains the resource. You can @@ -308,9 +311,6 @@ public partial interface IDatabasesOperations /// /// The name of the server. /// - /// - /// The name of the database to be resumed. - /// /// /// The headers that will be added to request. /// @@ -326,9 +326,9 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListInaccessibleByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Failovers a database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can @@ -339,11 +339,7 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: - /// 'Primary', 'ReadableSecondary' + /// The name of the database to be paused. /// /// /// The headers that will be added to request. @@ -354,12 +350,15 @@ public partial interface IDatabasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of inaccessible databases in a logical server + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can @@ -369,6 +368,9 @@ public partial interface IDatabasesOperations /// /// The name of the server. /// + /// + /// The name of the database to be resumed. + /// /// /// The headers that will be added to request. /// @@ -384,7 +386,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task>> ListInaccessibleByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Upgrades a data warehouse. /// @@ -602,7 +604,7 @@ public partial interface IDatabasesOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Pauses a database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can @@ -613,7 +615,11 @@ public partial interface IDatabasesOperations /// 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' /// /// /// The headers that will be added to request. @@ -624,15 +630,12 @@ public partial interface IDatabasesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Resumes a database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can @@ -643,7 +646,7 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database to be paused. /// /// /// The headers that will be added to request. @@ -660,9 +663,9 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Failovers a database. + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can @@ -673,11 +676,7 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: - /// 'Primary', 'ReadableSecondary' + /// The name of the database to be resumed. /// /// /// The headers that will be added to request. @@ -688,10 +687,13 @@ public partial interface IDatabasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Upgrades a data warehouse. /// 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/IManagedInstanceVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceVulnerabilityAssessmentsOperations.cs index e3ff4b0e9b7e..dd2670fff2e6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceVulnerabilityAssessmentsOperations.cs @@ -53,6 +53,9 @@ public partial interface IManagedInstanceVulnerabilityAssessmentsOperations Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates the managed instance's vulnerability assessment. + /// Learn more about setting SQL vulnerability assessment with managed + /// identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The name of the resource group that contains the resource. You can 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/IReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs index 7948b2f9f559..0982e58f6068 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs @@ -56,7 +56,8 @@ public partial interface IReplicationLinksOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a database replication link. + /// 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 @@ -67,10 +68,11 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database to get the link for. + /// The name of the database that has the replication link to be failed + /// over. /// /// - /// The replication link ID to be retrieved. + /// The ID of the replication link to be failed over. /// /// /// The headers that will be added to request. @@ -81,16 +83,14 @@ 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> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task FailoverWithHttpMessagesAsync(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. + /// current primary replica database. This operation might result in + /// data loss. /// /// /// The name of the resource group that contains the resource. You can @@ -119,11 +119,9 @@ public partial interface IReplicationLinksOperations /// /// 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 FailoverAllowDataLossWithHttpMessagesAsync(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. + /// Deletes a database replication link in forced or friendly way. /// /// /// The name of the resource group that contains the resource. You can @@ -140,6 +138,9 @@ public partial interface IReplicationLinksOperations /// /// 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. /// @@ -152,9 +153,9 @@ public partial interface IReplicationLinksOperations /// /// Thrown when a required parameter is null /// - Task FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links on database. /// /// /// The name of the resource group that contains the resource. You can @@ -162,17 +163,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 failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the database containing the replication link. /// /// /// The headers that will be added to request. @@ -183,12 +177,15 @@ 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 UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists a database's replication links. + /// Gets a replication link. /// /// /// The name of the resource group that contains the resource. You can @@ -196,10 +193,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 to retrieve links for. + /// The name of the database containing the replication link. + /// + /// + /// The name of the replication link. /// /// /// The headers that will be added to request. @@ -216,7 +216,34 @@ 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> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicationLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 containing the 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>> 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. @@ -316,5 +343,49 @@ public partial interface IReplicationLinksOperations /// 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)); + /// + /// Gets a list of replication links on 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)); + /// + /// Gets a list of replication links. + /// + /// + /// 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/IServerVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerVulnerabilityAssessmentsOperations.cs index 98952b625dfb..b31a9afd2ea1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerVulnerabilityAssessmentsOperations.cs @@ -52,7 +52,10 @@ public partial interface IServerVulnerabilityAssessmentsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the server's vulnerability assessment. + /// Creates or updates the server's vulnerability assessment. Learn + /// more about setting SQL vulnerability assessment with managed + /// identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The name of the resource group that contains the resource. You can 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 afd7f6233c12..4cfc0360356e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -142,11 +142,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IServerUsagesOperations ServerUsages { get; } - /// - /// Gets the IUsagesOperations. - /// - IUsagesOperations Usages { get; } - /// /// Gets the IBackupShortTermRetentionPoliciesOperations. /// @@ -187,16 +182,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IDatabaseColumnsOperations DatabaseColumns { get; } - /// - /// Gets the IDatabaseExtensionsOperations. - /// - IDatabaseExtensionsOperations DatabaseExtensions { get; } - - /// - /// Gets the IDatabaseOperations. - /// - IDatabaseOperations DatabaseOperations { get; } - /// /// Gets the IDatabaseRecommendedActionsOperations. /// @@ -217,11 +202,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IDatabaseTablesOperations DatabaseTables { get; } - /// - /// Gets the IDatabaseUsagesOperations. - /// - IDatabaseUsagesOperations DatabaseUsages { get; } - /// /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// @@ -517,16 +497,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; } - /// - /// Gets the IRestorableDroppedDatabasesOperations. - /// - IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } - - /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. - /// - IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } - /// /// Gets the IRestorePointsOperations. /// @@ -657,5 +627,45 @@ public partial interface ISqlManagementClient : System.IDisposable /// IWorkloadGroupsOperations WorkloadGroups { get; } + /// + /// Gets the IDatabaseExtensionsOperations. + /// + IDatabaseExtensionsOperations DatabaseExtensions { get; } + + /// + /// Gets the IDatabaseOperations. + /// + IDatabaseOperations DatabaseOperations { get; } + + /// + /// Gets the IDatabaseUsagesOperations. + /// + IDatabaseUsagesOperations DatabaseUsages { get; } + + /// + /// Gets the ILedgerDigestUploadsOperations. + /// + ILedgerDigestUploadsOperations LedgerDigestUploads { get; } + + /// + /// Gets the IOutboundFirewallRulesOperations. + /// + IOutboundFirewallRulesOperations OutboundFirewallRules { get; } + + /// + /// Gets the IRestorableDroppedDatabasesOperations. + /// + IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } + + /// + /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// + IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } + + /// + /// Gets the IUsagesOperations. + /// + IUsagesOperations Usages { get; } + } } 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..8af8676c11e9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LedgerDigestUploadsOperations.cs @@ -0,0 +1,1067 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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"); + } + string ledgerDigestUploads = "current"; + string apiVersion = "2021-02-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("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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 (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; + } + + /// + /// 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"); + } + string ledgerDigestUploads = "current"; + string apiVersion = "2021-02-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("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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 (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 != 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"); + } + string apiVersion = "2021-02-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("apiVersion", apiVersion); + 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 (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; + } + + /// + /// 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"); + } + string ledgerDigestUploads = "current"; + string apiVersion = "2021-02-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("ledgerDigestUploads", ledgerDigestUploads); + tracingParameters.Add("apiVersion", apiVersion); + 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 (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; + // 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/ManagedInstanceVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs index 2954c6cbdf32..5c13e0609252 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs @@ -250,7 +250,9 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c } /// - /// Creates or updates the managed instance's vulnerability assessment. + /// Creates or updates the managed instance's vulnerability assessment. Learn + /// more about setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The name of the resource group that contains the resource. You can obtain diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperationsExtensions.cs index f0e3ed1e731d..73c01fb83640 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperationsExtensions.cs @@ -66,7 +66,9 @@ public static ManagedInstanceVulnerabilityAssessment Get(this IManagedInstanceVu } /// - /// Creates or updates the managed instance's vulnerability assessment. + /// Creates or updates the managed instance's vulnerability assessment. Learn + /// more about setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The operations group for this extension method. @@ -88,7 +90,9 @@ public static ManagedInstanceVulnerabilityAssessment CreateOrUpdate(this IManage } /// - /// Creates or updates the managed instance's vulnerability assessment. + /// Creates or updates the managed instance's vulnerability assessment. Learn + /// more about setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The operations group for this extension method. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs index 9eb5276845e3..d8605dbe2b70 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs @@ -193,7 +193,13 @@ public Database() /// Maintenance configuration /// id assigned to the database. This configuration defines the period /// when the maintenance updates will occur. - public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string)) + /// Whether or not this database is a ledger + /// database, which means all tables in the database are ledger tables. + /// Note: the value of this property cannot be changed after the + /// database has been created. + /// Infra encryption is enabled + /// for this database. + public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?)) : base(location, id, name, type, tags) { Sku = sku; @@ -234,6 +240,8 @@ public Database() PausedDate = pausedDate; ResumedDate = resumedDate; MaintenanceConfigurationId = maintenanceConfigurationId; + IsLedgerOn = isLedgerOn; + IsInfraEncryptionEnabled = isInfraEncryptionEnabled; CustomInit(); } @@ -562,6 +570,21 @@ public Database() [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] public string MaintenanceConfigurationId { get; set; } + /// + /// Gets or sets whether or not this database is a ledger database, + /// which means all tables in the database are ledger tables. Note: the + /// value of this property cannot be changed after the database has + /// been created. + /// + [JsonProperty(PropertyName = "properties.isLedgerOn")] + public bool? IsLedgerOn { get; set; } + + /// + /// Gets infra encryption is enabled for this database. + /// + [JsonProperty(PropertyName = "properties.isInfraEncryptionEnabled")] + public bool? IsInfraEncryptionEnabled { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs index 025dc1ccc6b3..ae0fd44438a1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs @@ -170,8 +170,14 @@ public DatabaseUpdate() /// Maintenance configuration /// id assigned to the database. This configuration defines the period /// when the maintenance updates will occur. + /// Whether or not this database is a ledger + /// database, which means all tables in the database are ledger tables. + /// Note: the value of this property cannot be changed after the + /// database has been created. + /// Infra encryption is enabled + /// for this database. /// Resource tags. - public DatabaseUpdate(Sku sku = default(Sku), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), IDictionary tags = default(IDictionary)) + public DatabaseUpdate(Sku sku = default(Sku), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?), IDictionary tags = default(IDictionary)) { Sku = sku; CreateMode = createMode; @@ -209,6 +215,8 @@ public DatabaseUpdate() PausedDate = pausedDate; ResumedDate = resumedDate; MaintenanceConfigurationId = maintenanceConfigurationId; + IsLedgerOn = isLedgerOn; + IsInfraEncryptionEnabled = isInfraEncryptionEnabled; Tags = tags; CustomInit(); } @@ -510,6 +518,21 @@ public DatabaseUpdate() [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] public string MaintenanceConfigurationId { get; set; } + /// + /// Gets or sets whether or not this database is a ledger database, + /// which means all tables in the database are ledger tables. Note: the + /// value of this property cannot be changed after the database has + /// been created. + /// + [JsonProperty(PropertyName = "properties.isLedgerOn")] + public bool? IsLedgerOn { get; set; } + + /// + /// Gets infra encryption is enabled for this database. + /// + [JsonProperty(PropertyName = "properties.isInfraEncryptionEnabled")] + public bool? IsInfraEncryptionEnabled { get; private set; } + /// /// Gets or sets resource tags. /// 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/LedgerDigestUploadsState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploadsState.cs new file mode 100644 index 000000000000..bffe1059cfae --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LedgerDigestUploadsState.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 LedgerDigestUploadsState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LedgerDigestUploadsState + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class LedgerDigestUploadsStateEnumExtension + { + internal static string ToSerializedValue(this LedgerDigestUploadsState? value) + { + return value == null ? null : ((LedgerDigestUploadsState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this LedgerDigestUploadsState value) + { + switch( value ) + { + case LedgerDigestUploadsState.Enabled: + return "Enabled"; + case LedgerDigestUploadsState.Disabled: + return "Disabled"; + } + return null; + } + + internal static LedgerDigestUploadsState? ParseLedgerDigestUploadsState(this string value) + { + switch( value ) + { + case "Enabled": + return LedgerDigestUploadsState.Enabled; + case "Disabled": + return LedgerDigestUploadsState.Disabled; + } + return null; + } + } +} 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 aec229e8d1eb..55fa4e78481b 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 @@ -43,11 +43,13 @@ public ManagedInstanceVulnerabilityAssessment() /// 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. + /// isn't specified, StorageContainerSasKey is required. Applies only + /// if the storage account is not behind a Vnet or a firewall /// Specifies the identifier key /// of the storage account for vulnerability assessment scan results. /// If 'StorageContainerSasKey' isn't specified, - /// storageAccountAccessKey is required. + /// storageAccountAccessKey is required. Applies only if the storage + /// account is not behind a Vnet or a firewall /// The recurring scans settings public ManagedInstanceVulnerabilityAssessment(string storageContainerPath, string id = default(string), string name = default(string), string type = default(string), string storageContainerSasKey = default(string), string storageAccountAccessKey = default(string), VulnerabilityAssessmentRecurringScansProperties recurringScans = default(VulnerabilityAssessmentRecurringScansProperties)) : base(id, name, type) @@ -75,7 +77,8 @@ public ManagedInstanceVulnerabilityAssessment() /// 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. + /// StorageContainerSasKey is required. Applies only if the storage + /// account is not behind a Vnet or a firewall /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } @@ -84,7 +87,8 @@ public ManagedInstanceVulnerabilityAssessment() /// Gets or sets specifies the identifier key of the storage account /// for vulnerability assessment scan results. If /// 'StorageContainerSasKey' isn't specified, storageAccountAccessKey - /// is required. + /// is required. Applies only if the storage account is not behind a + /// Vnet or a firewall /// [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] public string StorageAccountAccessKey { get; 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/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/ReplicationState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationState.cs deleted file mode 100644 index 067c14bdb345..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationState.cs +++ /dev/null @@ -1,24 +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 ReplicationState. - /// - public static class ReplicationState - { - public const string PENDING = "PENDING"; - public const string SEEDING = "SEEDING"; - public const string CATCHUP = "CATCH_UP"; - public const string SUSPENDED = "SUSPENDED"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs index e7d0890219d8..eee789e538e0 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 @@ -43,15 +43,19 @@ public RestorableDroppedDatabase() /// The name of the database. /// The max size of the database expressed /// in bytes. - /// The resource name of the elastic pool - /// containing this database. + /// DEPRECATED: The resource name of the + /// elastic pool containing this database. This property is deprecated + /// and the value will always be null. /// The creation date of the database /// (ISO8601 format). /// The deletion date of the database /// (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), 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?)) + /// The storage account type used + /// to store backups for this database. Possible values include: 'Geo', + /// 'Local', 'Zone' + 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?), string backupStorageRedundancy = default(string)) : base(id, name, type) { Sku = sku; @@ -63,6 +67,7 @@ public RestorableDroppedDatabase() CreationDate = creationDate; DeletionDate = deletionDate; EarliestRestoreDate = earliestRestoreDate; + BackupStorageRedundancy = backupStorageRedundancy; CustomInit(); } @@ -102,8 +107,9 @@ public RestorableDroppedDatabase() public long? MaxSizeBytes { get; private set; } /// - /// Gets the resource name of the elastic pool containing this - /// database. + /// Gets DEPRECATED: The resource name of the elastic pool containing + /// this database. This property is deprecated and the value will + /// always be null. /// [JsonProperty(PropertyName = "properties.elasticPoolId")] public string ElasticPoolId { get; private set; } @@ -126,6 +132,13 @@ public RestorableDroppedDatabase() [JsonProperty(PropertyName = "properties.earliestRestoreDate")] public System.DateTime? EarliestRestoreDate { get; private set; } + /// + /// Gets the storage account type used to store backups for this + /// database. Possible values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.backupStorageRedundancy")] + public string BackupStorageRedundancy { get; private set; } + /// /// Validate the object. /// 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 a66171057791..c3f8f773b452 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 @@ -43,11 +43,13 @@ public ServerVulnerabilityAssessment() /// 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. + /// isn't specified, StorageContainerSasKey is required. Applies only + /// if the storage account is not behind a Vnet or a firewall /// Specifies the identifier key /// of the storage account for vulnerability assessment scan results. /// If 'StorageContainerSasKey' isn't specified, - /// storageAccountAccessKey is required. + /// storageAccountAccessKey is required. Applies only if the storage + /// account is not behind a Vnet or a firewall /// The recurring scans settings public ServerVulnerabilityAssessment(string storageContainerPath, string id = default(string), string name = default(string), string type = default(string), string storageContainerSasKey = default(string), string storageAccountAccessKey = default(string), VulnerabilityAssessmentRecurringScansProperties recurringScans = default(VulnerabilityAssessmentRecurringScansProperties)) : base(id, name, type) @@ -75,7 +77,8 @@ public ServerVulnerabilityAssessment() /// 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. + /// StorageContainerSasKey is required. Applies only if the storage + /// account is not behind a Vnet or a firewall /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } @@ -84,7 +87,8 @@ public ServerVulnerabilityAssessment() /// Gets or sets specifies the identifier key of the storage account /// for vulnerability assessment scan results. If /// 'StorageContainerSasKey' isn't specified, storageAccountAccessKey - /// is required. + /// is required. Applies only if the storage account is not behind a + /// Vnet or a firewall /// [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] public string StorageAccountAccessKey { get; set; } 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..b0ca0a6e227f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OutboundFirewallRulesOperations.cs @@ -0,0 +1,1086 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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"); + } + string apiVersion = "2021-02-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("outboundRuleFqdn", outboundRuleFqdn); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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 (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; + } + + /// + /// 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"); + } + string apiVersion = "2021-02-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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 (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; + } + + /// + /// 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"); + } + string apiVersion = "2021-02-01-preview"; + 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("apiVersion", apiVersion); + 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 (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a 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"); + } + string apiVersion = "2021-02-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("outboundRuleFqdn", outboundRuleFqdn); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/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 (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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/ReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs index 7861ec699f79..5b6868bfcf25 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs @@ -243,7 +243,38 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Gets a database replication link. + /// 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 @@ -253,10 +284,68 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to get the link for. + /// 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 replication link ID to be retrieved. + /// 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); + } + + /// + /// 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 containing the replication link. + /// + /// + /// The name of the database containing the replication link. /// /// /// Headers that will be added to request. @@ -279,12 +368,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>> 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"); @@ -297,11 +382,11 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (linkId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -309,22 +394,20 @@ 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("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/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) { @@ -423,7 +506,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")) @@ -436,7 +519,7 @@ internal ReplicationLinksOperations(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) { @@ -456,67 +539,609 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// 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 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. + /// 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)) + /// + /// 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 replicationLinkName, 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); - } + 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 (replicationLinkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "replicationLinkName"); + } + 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("replicationLinkName", replicationLinkName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/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("{replicationLinkName}", System.Uri.EscapeDataString(replicationLinkName)); + _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); + } - /// - /// 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); + + 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 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 containing the replication link. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/replicationLinks").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// 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 BeginFailoverWithHttpMessagesAsync(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, "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}/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)); + 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; + // 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 + { + _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; } /// - /// Deletes a database replication link in forced or friendly way. + /// 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 @@ -531,35 +1156,6 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// 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. - /// - /// - /// The name of the resource 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. - /// /// /// Headers that will be added to request. /// @@ -569,9 +1165,6 @@ 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 /// @@ -581,7 +1174,7 @@ 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 BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -599,6 +1192,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) { 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; @@ -611,16 +1208,18 @@ internal ReplicationLinksOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("linkId", linkId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + 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").ToString(); + 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) { @@ -633,7 +1232,7 @@ internal ReplicationLinksOperations(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) @@ -684,7 +1283,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -719,31 +1318,13 @@ 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); @@ -752,8 +1333,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Deletes a database replication link in forced or friendly way. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -768,6 +1348,9 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// The ID of the replication link to be failed over. /// + /// + /// The required parameters for unlinking replication link. + /// /// /// Headers that will be added to request. /// @@ -786,7 +1369,7 @@ 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 BeginUnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -808,6 +1391,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) { 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; @@ -821,12 +1408,13 @@ internal ReplicationLinksOperations(SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("linkId", linkId); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUnlink", 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(); + 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)); @@ -875,6 +1463,12 @@ 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) { @@ -945,21 +1539,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// 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 name of the resource 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. @@ -970,6 +1553,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 /// @@ -979,29 +1565,12 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// 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)) + 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; @@ -1009,27 +1578,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, "BeginFailoverAllowDataLoss", 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}/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)); + 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); @@ -1037,7 +1593,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) @@ -1088,7 +1644,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 @@ -1123,13 +1679,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); @@ -1138,23 +1712,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 +1726,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 +1738,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) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) + if (nextPageLink == 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"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2014-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1208,28 +1751,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 +1766,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 +1797,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 +1817,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 +1852,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..7b89dd57fb38 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; @@ -75,7 +73,8 @@ public static void Delete(this IReplicationLinksOperations operations, string re } /// - /// Gets a database replication link. + /// Sets which replica database is primary by failing over from the current + /// primary replica database. /// /// /// The operations group for this extension method. @@ -88,18 +87,19 @@ public static void Delete(this IReplicationLinksOperations operations, string re /// The name of the server. /// /// - /// The name of the database to get the link for. + /// The name of the database that has the replication link to be failed over. /// /// - /// The replication link ID to be retrieved. + /// The ID of the replication link to be failed over. /// - public static ReplicationLink Get(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static void Failover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + operations.FailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Gets a database replication link. + /// Sets which replica database is primary by failing over from the current + /// primary replica database. /// /// /// The operations group for this extension method. @@ -112,25 +112,22 @@ public static ReplicationLink Get(this IReplicationLinksOperations operations, s /// The name of the server. /// /// - /// The name of the database to get the link for. + /// The name of the database that has the replication link to be failed over. /// /// - /// The replication link ID to be retrieved. + /// The ID of the replication link to be failed over. /// /// /// 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 FailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// primary replica database. This operation might result in data loss. /// /// /// The operations group for this extension method. @@ -148,14 +145,14 @@ public static ReplicationLink Get(this IReplicationLinksOperations operations, s /// /// 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) + public static void FailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - operations.FailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + operations.FailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// primary replica database. This operation might result in data loss. /// /// /// The operations group for this extension method. @@ -176,14 +173,13 @@ public static void Failover(this IReplicationLinksOperations operations, string /// /// 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 async Task FailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.FailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Deletes a database replication link in forced or friendly way. /// /// /// The operations group for this extension method. @@ -201,14 +197,16 @@ public static void Failover(this IReplicationLinksOperations operations, string /// /// 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) + /// + /// 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.FailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + operations.UnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Deletes a database replication link in forced or friendly way. /// /// /// The operations group for this extension method. @@ -226,16 +224,19 @@ public static void FailoverAllowDataLoss(this IReplicationLinksOperations operat /// /// The ID of the replication link to be failed over. /// + /// + /// The required parameters for unlinking 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 UnlinkAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.UnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -245,24 +246,18 @@ public static void FailoverAllowDataLoss(this IReplicationLinksOperations operat /// 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. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the database containing the replication link. /// - public static void Unlink(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) + public static IPage ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) { - operations.UnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Deletes a database replication link in forced or friendly way. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -272,27 +267,24 @@ public static void Unlink(this IReplicationLinksOperations operations, string re /// 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. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the database containing the 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)) + public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Lists a database's replication links. + /// Gets a replication link. /// /// /// The operations group for this extension method. @@ -302,18 +294,21 @@ public static void Unlink(this IReplicationLinksOperations operations, string re /// 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 retrieve links for. + /// The name of the database containing the replication link. + /// + /// + /// The name of the replication link. /// - public static IEnumerable ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) + public static ReplicationLink Get(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string replicationLinkName) { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, replicationLinkName).GetAwaiter().GetResult(); } /// - /// Lists a database's replication links. + /// Gets a replication link. /// /// /// The operations group for this extension method. @@ -323,17 +318,62 @@ 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 server containing the replication link. /// /// - /// The name of the database to retrieve links for. + /// The name of the database containing the replication link. + /// + /// + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string replicationLinkName, 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; + } + } + + /// + /// 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 containing the replication link. + /// + public static IPage ListByServer(this IReplicationLinksOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// 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 containing the replication link. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -502,5 +542,73 @@ public static void BeginUnlink(this IReplicationLinksOperations operations, stri (await operations.BeginUnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets a list of replication links on database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IReplicationLinksOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of replication links on 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 IReplicationLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of replication links. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IReplicationLinksOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of replication links. + /// + /// + /// 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 IReplicationLinksOperations 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/RestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs index 242c5a46f276..2c7139fe277b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs @@ -95,7 +95,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -296,7 +296,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 f91949e22061..f387b0e9e062 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,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -296,7 +296,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 c439f990d66a..5b322c535b57 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 @@ -28,18 +28,18 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "DatabaseAutomaticTuning", "2020-11-01-preview"), new Tuple("Sql", "DatabaseBlobAuditingPolicies", "2020-11-01-preview"), new Tuple("Sql", "DatabaseColumns", "2020-11-01-preview"), - new Tuple("Sql", "DatabaseExtensions", "2020-11-01-preview"), - new Tuple("Sql", "DatabaseOperations", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseExtensions", "2021-02-01-preview"), + new Tuple("Sql", "DatabaseOperations", "2021-02-01-preview"), new Tuple("Sql", "DatabaseRecommendedActions", "2020-11-01-preview"), new Tuple("Sql", "DatabaseSchemas", "2020-11-01-preview"), new Tuple("Sql", "DatabaseSecurityAlertPolicies", "2020-11-01-preview"), new Tuple("Sql", "DatabaseTables", "2020-11-01-preview"), - new Tuple("Sql", "DatabaseUsages", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseUsages", "2021-02-01-preview"), new Tuple("Sql", "DatabaseVulnerabilityAssessmentRuleBaselines", "2020-11-01-preview"), new Tuple("Sql", "DatabaseVulnerabilityAssessmentScans", "2020-11-01-preview"), new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2020-11-01-preview"), new Tuple("Sql", "Databases", "2014-04-01"), - new Tuple("Sql", "Databases", "2020-11-01-preview"), + new Tuple("Sql", "Databases", "2021-02-01-preview"), new Tuple("Sql", "DeletedServers", "2020-11-01-preview"), new Tuple("Sql", "ElasticPoolActivities", "2014-04-01"), new Tuple("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"), @@ -63,6 +63,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "JobTargetGroups", "2020-11-01-preview"), new Tuple("Sql", "JobVersions", "2020-11-01-preview"), new Tuple("Sql", "Jobs", "2020-11-01-preview"), + new Tuple("Sql", "LedgerDigestUploads", "2021-02-01-preview"), new Tuple("Sql", "LongTermRetentionBackups", "2020-11-01-preview"), new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2020-11-01-preview"), new Tuple("Sql", "LongTermRetentionPolicies", "2020-11-01-preview"), @@ -98,14 +99,16 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2020-11-01-preview"), new Tuple("Sql", "Operations", "2020-11-01-preview"), new Tuple("Sql", "OperationsHealth", "2020-11-01-preview"), + new Tuple("Sql", "OutboundFirewallRules", "2021-02-01-preview"), new Tuple("Sql", "PrivateEndpointConnections", "2020-11-01-preview"), new Tuple("Sql", "PrivateLinkResources", "2020-11-01-preview"), new Tuple("Sql", "RecommendedSensitivityLabels", "2020-11-01-preview"), new Tuple("Sql", "RecoverableDatabases", "2014-04-01"), new Tuple("Sql", "RecoverableManagedDatabases", "2020-11-01-preview"), new Tuple("Sql", "ReplicationLinks", "2014-04-01"), - new Tuple("Sql", "RestorableDroppedDatabases", "2020-11-01-preview"), - new Tuple("Sql", "RestorableDroppedManagedDatabases", "2020-11-01-preview"), + new Tuple("Sql", "ReplicationLinks", "2020-11-01-preview"), + new Tuple("Sql", "RestorableDroppedDatabases", "2021-02-01-preview"), + new Tuple("Sql", "RestorableDroppedManagedDatabases", "2021-02-01-preview"), new Tuple("Sql", "RestorePoints", "2020-11-01-preview"), new Tuple("Sql", "SensitivityLabels", "2020-11-01-preview"), new Tuple("Sql", "ServerAdvisors", "2020-11-01-preview"), @@ -134,7 +137,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "TimeZones", "2020-11-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", "Usages", "2021-02-01-preview"), new Tuple("Sql", "VirtualClusters", "2020-11-01-preview"), new Tuple("Sql", "VirtualNetworkRules", "2020-11-01-preview"), new Tuple("Sql", "WorkloadClassifiers", "2020-11-01-preview"), 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 650ccf656ca7..5c09b530c523 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs @@ -249,7 +249,9 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) } /// - /// Creates or updates the server's vulnerability assessment. + /// Creates or updates the server's vulnerability assessment. Learn more about + /// setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The name of the resource group that contains the resource. You can obtain diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperationsExtensions.cs index aac14be6e594..aa2f2cdb2682 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperationsExtensions.cs @@ -64,7 +64,9 @@ public static ServerVulnerabilityAssessment Get(this IServerVulnerabilityAssessm } /// - /// Creates or updates the server's vulnerability assessment. + /// Creates or updates the server's vulnerability assessment. Learn more about + /// setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The operations group for this extension method. @@ -85,7 +87,9 @@ public static ServerVulnerabilityAssessment CreateOrUpdate(this IServerVulnerabi } /// - /// Creates or updates the server's vulnerability assessment. + /// Creates or updates the server's vulnerability assessment. Learn more about + /// setting SQL vulnerability assessment with managed identity - + /// https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage /// /// /// The operations group for this extension method. 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 075753414de7..ea914af18ccd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -147,11 +147,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IServerUsagesOperations ServerUsages { get; private set; } - /// - /// Gets the IUsagesOperations. - /// - public virtual IUsagesOperations Usages { get; private set; } - /// /// Gets the IBackupShortTermRetentionPoliciesOperations. /// @@ -192,16 +187,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IDatabaseColumnsOperations DatabaseColumns { get; private set; } - /// - /// Gets the IDatabaseExtensionsOperations. - /// - public virtual IDatabaseExtensionsOperations DatabaseExtensions { get; private set; } - - /// - /// Gets the IDatabaseOperations. - /// - public virtual IDatabaseOperations DatabaseOperations { get; private set; } - /// /// Gets the IDatabaseRecommendedActionsOperations. /// @@ -222,11 +207,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IDatabaseTablesOperations DatabaseTables { get; private set; } - /// - /// Gets the IDatabaseUsagesOperations. - /// - public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } - /// /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. /// @@ -522,16 +502,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } - /// - /// Gets the IRestorableDroppedDatabasesOperations. - /// - public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } - - /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. - /// - public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } - /// /// Gets the IRestorePointsOperations. /// @@ -662,6 +632,46 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } + /// + /// Gets the IDatabaseExtensionsOperations. + /// + public virtual IDatabaseExtensionsOperations DatabaseExtensions { get; private set; } + + /// + /// Gets the IDatabaseOperations. + /// + public virtual IDatabaseOperations DatabaseOperations { get; private set; } + + /// + /// Gets the IDatabaseUsagesOperations. + /// + public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } + + /// + /// Gets the ILedgerDigestUploadsOperations. + /// + public virtual ILedgerDigestUploadsOperations LedgerDigestUploads { get; private set; } + + /// + /// Gets the IOutboundFirewallRulesOperations. + /// + public virtual IOutboundFirewallRulesOperations OutboundFirewallRules { get; private set; } + + /// + /// Gets the IRestorableDroppedDatabasesOperations. + /// + public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } + + /// + /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// + public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } + + /// + /// Gets the IUsagesOperations. + /// + public virtual IUsagesOperations Usages { get; private set; } + /// /// Initializes a new instance of the SqlManagementClient class. /// @@ -918,7 +928,6 @@ private void Initialize() TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); TransparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesOperations(this); ServerUsages = new ServerUsagesOperations(this); - Usages = new UsagesOperations(this); BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); ExtendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesOperations(this); ExtendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesOperations(this); @@ -927,13 +936,10 @@ private void Initialize() 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); DatabaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsOperations(this); DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); @@ -993,8 +999,6 @@ private void Initialize() PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); - RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); - RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); RestorePoints = new RestorePointsOperations(this); SensitivityLabels = new SensitivityLabelsOperations(this); RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); @@ -1021,6 +1025,14 @@ private void Initialize() VirtualNetworkRules = new VirtualNetworkRulesOperations(this); WorkloadClassifiers = new WorkloadClassifiersOperations(this); WorkloadGroups = new WorkloadGroupsOperations(this); + DatabaseExtensions = new DatabaseExtensionsOperations(this); + DatabaseOperations = new DatabaseOperations(this); + DatabaseUsages = new DatabaseUsagesOperations(this); + LedgerDigestUploads = new LedgerDigestUploadsOperations(this); + OutboundFirewallRules = new OutboundFirewallRulesOperations(this); + RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); + RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); + Usages = new UsagesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs index 1744c63f95b7..3453de3b17c1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/UsagesOperations.cs @@ -99,7 +99,7 @@ internal UsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null;