diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs
deleted file mode 100644
index d5b787fb9466..000000000000
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Text.Json;
-using System.Threading;
-using System.Threading.Tasks;
-using Azure;
-using Azure.Core;
-using Azure.Core.Pipeline;
-using Azure.ResourceManager.Sql.Models;
-
-namespace Azure.ResourceManager.Sql
-{
- /// Sets a database's long term retention policy.
- public partial class BackupLongTermRetentionPoliciesCreateOrUpdateOperation : Operation, IOperationSource
- {
- private readonly ArmOperationHelpers _operation;
-
- /// Initializes a new instance of BackupLongTermRetentionPoliciesCreateOrUpdateOperation for mocking.
- protected BackupLongTermRetentionPoliciesCreateOrUpdateOperation()
- {
- }
-
- internal BackupLongTermRetentionPoliciesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
- {
- _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "BackupLongTermRetentionPoliciesCreateOrUpdateOperation");
- }
- ///
- public override string Id => _operation.Id;
-
- ///
- public override BackupLongTermRetentionPolicy Value => _operation.Value;
-
- ///
- public override bool HasCompleted => _operation.HasCompleted;
-
- ///
- public override bool HasValue => _operation.HasValue;
-
- ///
- public override Response GetRawResponse() => _operation.GetRawResponse();
-
- ///
- public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
-
- ///
- public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
-
- ///
- public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
-
- ///
- public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken);
-
- BackupLongTermRetentionPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken)
- {
- using var document = JsonDocument.Parse(response.ContentStream);
- return BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
- }
-
- async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken)
- {
- using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- return BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
- }
- }
-}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs
index adc2b23f8f44..2087808cce03 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs
@@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(databaseName, true);
uri.AppendPath("/backupShortTermRetentionPolicies/", false);
uri.AppendPath(policyName.ToString(), true);
- uri.AppendQuery("api-version", "2020-02-02-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin
uri.AppendPath(databaseName, true);
uri.AppendPath("/backupShortTermRetentionPolicies/", false);
uri.AppendPath(policyName.ToString(), true);
- uri.AppendQuery("api-version", "2020-02-02-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -264,7 +264,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server
uri.AppendPath(databaseName, true);
uri.AppendPath("/backupShortTermRetentionPolicies/", false);
uri.AppendPath(policyName.ToString(), true);
- uri.AppendQuery("api-version", "2020-02-02-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -368,7 +368,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/backupShortTermRetentionPolicies", false);
- uri.AppendQuery("api-version", "2020-02-02-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs
index 94039ef55ca0..3f8c004b79be 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs
@@ -59,7 +59,7 @@ internal HttpMessage CreateListByLocationRequest(string locationName, Capability
{
uri.AppendQuery("include", include.Value.ToString(), true);
}
- uri.AppendQuery("api-version", "2018-06-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs
new file mode 100644
index 000000000000..e5bf6b5bc5ea
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs
@@ -0,0 +1,192 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DataWarehouseUserActivities service client.
+ public partial class DataWarehouseUserActivitiesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DataWarehouseUserActivitiesRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DataWarehouseUserActivitiesOperations for mocking.
+ protected DataWarehouseUserActivitiesOperations()
+ {
+ }
+
+ /// Initializes a new instance of DataWarehouseUserActivitiesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DataWarehouseUserActivitiesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DataWarehouseUserActivitiesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets the user activities of a data warehouse which includes running and suspended queries.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The activity name of the data warehouse.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets the user activities of a data warehouse which includes running and suspended queries.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The activity name of the data warehouse.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List the user activities of a data warehouse which includes running and suspended queries.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List the user activities of a data warehouse which includes running and suspended queries.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs
similarity index 67%
rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs
rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs
index ba174e0c3a1d..5fa22b75d717 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs
@@ -16,20 +16,20 @@
namespace Azure.ResourceManager.Sql
{
- internal partial class BackupLongTermRetentionPoliciesRestOperations
+ internal partial class DataWarehouseUserActivitiesRestOperations
{
private string subscriptionId;
private Uri endpoint;
private ClientDiagnostics _clientDiagnostics;
private HttpPipeline _pipeline;
- /// Initializes a new instance of BackupLongTermRetentionPoliciesRestOperations.
+ /// Initializes a new instance of DataWarehouseUserActivitiesRestOperations.
/// The handler for diagnostic messaging in the client.
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// The subscription ID that identifies an Azure subscription.
/// server parameter.
/// is null.
- public BackupLongTermRetentionPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ public DataWarehouseUserActivitiesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
{
if (subscriptionId == null)
{
@@ -43,7 +43,7 @@ public BackupLongTermRetentionPoliciesRestOperations(ClientDiagnostics clientDia
_pipeline = pipeline;
}
- internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName)
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
@@ -58,22 +58,22 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(serverName, true);
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
- uri.AppendPath("/backupLongTermRetentionPolicies/", false);
- uri.AppendPath(policyName.ToString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendPath("/dataWarehouseUserActivities/", false);
+ uri.AppendPath(dataWarehouseUserActivityName.ToString(), true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
- /// Gets a database's long term retention policy.
+ /// Gets the user activities of a data warehouse which includes running and suspended queries.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
- /// The policy name. Should always be Default.
+ /// The activity name of the data warehouse.
/// The cancellation token to use.
/// , , or is null.
- public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default)
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -88,15 +88,15 @@ public async Task> GetAsync(string resou
throw new ArgumentNullException(nameof(databaseName));
}
- using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName);
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
- BackupLongTermRetentionPolicy value = default;
+ DataWarehouseUserActivities value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
+ value = DataWarehouseUserActivities.DeserializeDataWarehouseUserActivities(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
@@ -104,14 +104,14 @@ public async Task> GetAsync(string resou
}
}
- /// Gets a database's long term retention policy.
+ /// Gets the user activities of a data warehouse which includes running and suspended queries.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
- /// The policy name. Should always be Default.
+ /// The activity name of the data warehouse.
/// The cancellation token to use.
/// , , or is null.
- public Response Get(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default)
+ public Response Get(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -126,15 +126,15 @@ public Response Get(string resourceGroupName, str
throw new ArgumentNullException(nameof(databaseName));
}
- using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName);
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
- BackupLongTermRetentionPolicy value = default;
+ DataWarehouseUserActivities value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
+ value = DataWarehouseUserActivities.DeserializeDataWarehouseUserActivities(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
@@ -142,11 +142,11 @@ public Response Get(string resourceGroupName, str
}
}
- internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters)
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
- request.Method = RequestMethod.Put;
+ request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
@@ -157,27 +157,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin
uri.AppendPath(serverName, true);
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
- uri.AppendPath("/backupLongTermRetentionPolicies/", false);
- uri.AppendPath(policyName.ToString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendPath("/dataWarehouseUserActivities", false);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(parameters);
- request.Content = content;
return message;
}
- /// Sets a database's long term retention policy.
+ /// List the user activities of a data warehouse which includes running and suspended queries.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
- /// The policy name. Should always be Default.
- /// The long term retention policy info.
/// The cancellation token to use.
- /// , , , or is null.
- public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default)
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -191,32 +184,30 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string
{
throw new ArgumentNullException(nameof(databaseName));
}
- if (parameters == null)
- {
- throw new ArgumentNullException(nameof(parameters));
- }
- using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters);
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
- case 202:
- return message.Response;
+ {
+ DataWarehouseUserActivitiesListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
- /// Sets a database's long term retention policy.
+ /// List the user activities of a data warehouse which includes running and suspended queries.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
- /// The policy name. Should always be Default.
- /// The long term retention policy info.
/// The cancellation token to use.
- /// , , , or is null.
- public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default)
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -230,53 +221,49 @@ public Response CreateOrUpdate(string resourceGroupName, string serverName, stri
{
throw new ArgumentNullException(nameof(databaseName));
}
- if (parameters == null)
- {
- throw new ArgumentNullException(nameof(parameters));
- }
- using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters);
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
- case 202:
- return message.Response;
+ {
+ DataWarehouseUserActivitiesListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
- internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName)
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
- uri.AppendPath("/subscriptions/", false);
- uri.AppendPath(subscriptionId, true);
- uri.AppendPath("/resourceGroups/", false);
- uri.AppendPath(resourceGroupName, true);
- uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
- uri.AppendPath(serverName, true);
- uri.AppendPath("/databases/", false);
- uri.AppendPath(databaseName, true);
- uri.AppendPath("/backupLongTermRetentionPolicies", false);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendRawNextLink(nextLink, false);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
- /// Gets a database's long term retention policy.
+ /// List the user activities of a data warehouse which includes running and suspended queries.
+ /// The URL to the next page of results.
/// The name of the resource group 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 to use.
- /// , , or is null.
- public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
{
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
@@ -290,15 +277,15 @@ public async Task> ListByDatabaseAsync(s
throw new ArgumentNullException(nameof(databaseName));
}
- using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
- BackupLongTermRetentionPolicy value = default;
+ DataWarehouseUserActivitiesListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
+ value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
@@ -306,14 +293,19 @@ public async Task> ListByDatabaseAsync(s
}
}
- /// Gets a database's long term retention policy.
+ /// List the user activities of a data warehouse which includes running and suspended queries.
+ /// The URL to the next page of results.
/// The name of the resource group 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 to use.
- /// , , or is null.
- public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
{
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
@@ -327,15 +319,15 @@ public Response ListByDatabase(string resourceGro
throw new ArgumentNullException(nameof(databaseName));
}
- using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
- BackupLongTermRetentionPolicy value = default;
+ DataWarehouseUserActivitiesListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement);
+ value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs
new file mode 100644
index 000000000000..94761371319b
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs
@@ -0,0 +1,170 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseAdvisors service client.
+ public partial class DatabaseAdvisorsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseAdvisorsRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseAdvisorsOperations for mocking.
+ protected DatabaseAdvisorsOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseAdvisorsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseAdvisorsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseAdvisorsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets a list of database advisors.
+ /// The name of the resource group 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 child resources to include in the response.
+ /// The cancellation token to use.
+ public virtual async Task>> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, expand, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of database advisors.
+ /// The name of the resource group 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 child resources to include in the response.
+ /// The cancellation token to use.
+ public virtual Response> ListByDatabase(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ return RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, expand, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, advisorName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, advisorName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The requested advisor resource state.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The requested advisor resource state.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, serverName, databaseName, advisorName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs
new file mode 100644
index 000000000000..aa00031809d3
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs
@@ -0,0 +1,387 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseAdvisorsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseAdvisorsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseAdvisorsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string expand)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors", false);
+ if (expand != null)
+ {
+ uri.AppendQuery("$expand", expand, true);
+ }
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a list of database advisors.
+ /// The name of the resource group 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 child resources to include in the response.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task>> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, expand);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(Advisor.DeserializeAdvisor(item));
+ }
+ value = array;
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a list of database advisors.
+ /// The name of the resource group 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 child resources to include in the response.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response> ListByDatabase(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, expand);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(Advisor.DeserializeAdvisor(item));
+ }
+ value = array;
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string advisorName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors/", false);
+ uri.AppendPath(advisorName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Advisor value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = Advisor.DeserializeAdvisor(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Advisor value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = Advisor.DeserializeAdvisor(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors/", false);
+ uri.AppendPath(advisorName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The requested advisor resource state.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Advisor value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = Advisor.DeserializeAdvisor(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates a database advisor.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The requested advisor resource state.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ Advisor value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = Advisor.DeserializeAdvisor(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs
index b9069ac8ac13..8d10cae8115e 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs
@@ -59,7 +59,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/automaticTuning/current", false);
- uri.AppendQuery("api-version", "2015-05-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -155,7 +155,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/automaticTuning/current", false);
- uri.AppendQuery("api-version", "2015-05-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs
index eaa178bd06b2..f69864bb6d6d 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs
@@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(databaseName, true);
uri.AppendPath("/auditingSettings/", false);
uri.AppendPath("default", true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -157,7 +157,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin
uri.AppendPath(databaseName, true);
uri.AppendPath("/auditingSettings/", false);
uri.AppendPath("default", true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -269,7 +269,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/auditingSettings", false);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs
new file mode 100644
index 000000000000..6f101e39143f
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs
@@ -0,0 +1,337 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseColumns service client.
+ public partial class DatabaseColumnsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseColumnsRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseColumnsOperations for mocking.
+ protected DatabaseColumnsOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseColumnsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseColumnsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseColumnsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Get database column.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The name of the column.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get database column.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The name of the column.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public virtual AsyncPageable ListByTableAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByTableNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public virtual Pageable ListByTable(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByTable(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByTableNextPage(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs
new file mode 100644
index 000000000000..b172b0742eda
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs
@@ -0,0 +1,656 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseColumnsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseColumnsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseColumnsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/columns", false);
+ if (schema != null)
+ {
+ uri.AppendQueryDelimited("schema", schema, ",", true);
+ }
+ if (table != null)
+ {
+ uri.AppendQueryDelimited("table", table, ",", true);
+ }
+ if (column != null)
+ {
+ uri.AppendQueryDelimited("column", column, ",", true);
+ }
+ if (orderBy != null)
+ {
+ uri.AppendQueryDelimited("orderBy", orderBy, ",", true);
+ }
+ if (skiptoken != null)
+ {
+ uri.AppendQuery("$skiptoken", skiptoken, true);
+ }
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByTableRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas/", false);
+ uri.AppendPath(schemaName, true);
+ uri.AppendPath("/tables/", false);
+ uri.AppendPath(tableName, true);
+ uri.AppendPath("/columns", false);
+ if (filter != null)
+ {
+ uri.AppendQuery("$filter", filter, true);
+ }
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task> ListByTableAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateListByTableRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database columns.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response ListByTable(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateListByTableRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas/", false);
+ uri.AppendPath(schemaName, true);
+ uri.AppendPath("/tables/", false);
+ uri.AppendPath(tableName, true);
+ uri.AppendPath("/columns/", false);
+ uri.AppendPath(columnName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Get database column.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The name of the column.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+ if (columnName == null)
+ {
+ throw new ArgumentNullException(nameof(columnName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumn value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get database column.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The name of the column.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+ if (columnName == null)
+ {
+ throw new ArgumentNullException(nameof(columnName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumn value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database columns.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database columns.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 ArrayOfGet3ItemsItem to use.
+ /// The ArrayOfGet4ItemsItem to use.
+ /// The ArrayOfGet5ItemsItem to use.
+ /// The ArrayOfGet6ItemsItem to use.
+ /// An opaque token that identifies a starting point in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByTableNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database columns.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public async Task> ListByTableNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database columns.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public Response ListByTableNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseColumnListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs
new file mode 100644
index 000000000000..4bad03accd63
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// Perform a database extension operation, like polybase import.
+ public partial class DatabaseExtensionsCreateOrUpdateOperation : Operation, IOperationSource
+ {
+ private readonly ArmOperationHelpers _operation;
+
+ /// Initializes a new instance of DatabaseExtensionsCreateOrUpdateOperation for mocking.
+ protected DatabaseExtensionsCreateOrUpdateOperation()
+ {
+ }
+
+ internal DatabaseExtensionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
+ {
+ _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseExtensionsCreateOrUpdateOperation");
+ }
+ ///
+ public override string Id => _operation.Id;
+
+ ///
+ public override ImportExportExtensionsOperationResult Value => _operation.Value;
+
+ ///
+ public override bool HasCompleted => _operation.HasCompleted;
+
+ ///
+ public override bool HasValue => _operation.HasValue;
+
+ ///
+ public override Response GetRawResponse() => _operation.GetRawResponse();
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
+
+ ///
+ public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken);
+
+ ImportExportExtensionsOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken)
+ {
+ using var document = JsonDocument.Parse(response.ContentStream);
+ return ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(document.RootElement);
+ }
+
+ async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken)
+ {
+ using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ return ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(document.RootElement);
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs
new file mode 100644
index 000000000000..24bc450d20be
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs
@@ -0,0 +1,282 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseExtensions service client.
+ public partial class DatabaseExtensionsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseExtensionsRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseExtensionsOperations for mocking.
+ protected DatabaseExtensionsOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseExtensionsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseExtensionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseExtensionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets a database extension. This will return resource not found as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The cancellation token to use.
+ public virtual async Task GetAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, extensionName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database extension. This will return resource not found as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, extensionName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Perform a database extension operation, like polybase import.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The database import request parameters.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.StartCreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken).ConfigureAwait(false);
+ return new DatabaseExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Perform a database extension operation, like polybase import.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The database import request parameters.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public virtual DatabaseExtensionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.StartCreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken);
+ return new DatabaseExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs
new file mode 100644
index 000000000000..8f52e8cc69dd
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs
@@ -0,0 +1,448 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseExtensionsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseExtensionsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseExtensionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string extensionName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/extensions/", false);
+ uri.AppendPath(extensionName, true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
+ request.Uri = uri;
+ return message;
+ }
+
+ /// Gets a database extension. This will return resource not found as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task GetAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, extensionName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a database extension. This will return resource not found as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, extensionName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/extensions/", false);
+ uri.AppendPath(extensionName, true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Perform a database extension operation, like polybase import.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The database import request parameters.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ return message.Response;
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Perform a database extension operation, like polybase import.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The String to use.
+ /// The database import request parameters.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (extensionName == null)
+ {
+ throw new ArgumentNullException(nameof(extensionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 202:
+ return message.Response;
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/extensions", false);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ImportExportExtensionsOperationListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ImportExportExtensionsOperationListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 to use.
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ImportExportExtensionsOperationListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database extension. This will return an empty list as it is not supported.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 to use.
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ ImportExportExtensionsOperationListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs
new file mode 100644
index 000000000000..c52346662be2
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs
@@ -0,0 +1,174 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseRecommendedActions service client.
+ public partial class DatabaseRecommendedActionsOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseRecommendedActionsRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseRecommendedActionsOperations for mocking.
+ protected DatabaseRecommendedActionsOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseRecommendedActionsOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseRecommendedActionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseRecommendedActionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets list of Database Recommended Actions.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ public virtual async Task>> ListByDatabaseAdvisorAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.ListByDatabaseAdvisor");
+ scope.Start();
+ try
+ {
+ return await RestClient.ListByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets list of Database Recommended Actions.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ public virtual Response> ListByDatabaseAdvisor(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.ListByDatabaseAdvisor");
+ scope.Start();
+ try
+ {
+ return RestClient.ListByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The requested recommended action resource state.
+ /// The cancellation token to use.
+ public virtual async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Update");
+ scope.Start();
+ try
+ {
+ return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Updates a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The requested recommended action resource state.
+ /// The cancellation token to use.
+ public virtual Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Update");
+ scope.Start();
+ try
+ {
+ return RestClient.Update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs
new file mode 100644
index 000000000000..d995fed20a19
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs
@@ -0,0 +1,417 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseRecommendedActionsRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseRecommendedActionsRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseRecommendedActionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListByDatabaseAdvisorRequest(string resourceGroupName, string serverName, string databaseName, string advisorName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors/", false);
+ uri.AppendPath(advisorName, true);
+ uri.AppendPath("/recommendedActions", false);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets list of Database Recommended Actions.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task>> ListByDatabaseAdvisorAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+
+ using var message = CreateListByDatabaseAdvisorRequest(resourceGroupName, serverName, databaseName, advisorName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IReadOnlyList value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(RecommendedAction.DeserializeRecommendedAction(item));
+ }
+ value = array;
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets list of Database Recommended Actions.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response> ListByDatabaseAdvisor(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+
+ using var message = CreateListByDatabaseAdvisorRequest(resourceGroupName, serverName, databaseName, advisorName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ IReadOnlyList value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ List array = new List();
+ foreach (var item in document.RootElement.EnumerateArray())
+ {
+ array.Add(RecommendedAction.DeserializeRecommendedAction(item));
+ }
+ value = array;
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors/", false);
+ uri.AppendPath(advisorName, true);
+ uri.AppendPath("/recommendedActions/", false);
+ uri.AppendPath(recommendedActionName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (recommendedActionName == null)
+ {
+ throw new ArgumentNullException(nameof(recommendedActionName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ RecommendedAction value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = RecommendedAction.DeserializeRecommendedAction(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (recommendedActionName == null)
+ {
+ throw new ArgumentNullException(nameof(recommendedActionName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ RecommendedAction value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = RecommendedAction.DeserializeRecommendedAction(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/advisors/", false);
+ uri.AppendPath(advisorName, true);
+ uri.AppendPath("/recommendedActions/", false);
+ uri.AppendPath(recommendedActionName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Updates a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The requested recommended action resource state.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (recommendedActionName == null)
+ {
+ throw new ArgumentNullException(nameof(recommendedActionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ RecommendedAction value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = RecommendedAction.DeserializeRecommendedAction(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Updates a database recommended action.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the Database Advisor.
+ /// The name of Database Recommended Action.
+ /// The requested recommended action resource state.
+ /// The cancellation token to use.
+ /// , , , , , or is null.
+ public Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (advisorName == null)
+ {
+ throw new ArgumentNullException(nameof(advisorName));
+ }
+ if (recommendedActionName == null)
+ {
+ throw new ArgumentNullException(nameof(recommendedActionName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ RecommendedAction value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = RecommendedAction.DeserializeRecommendedAction(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs
index 453ca0ccb7da..14bde864b4ba 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs
@@ -61,7 +61,7 @@ internal HttpMessage CreateCancelRequest(string resourceGroupName, string server
uri.AppendPath("/operations/", false);
uri.AppendPath(operationId, true);
uri.AppendPath("/cancel", false);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
return message;
}
@@ -148,7 +148,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/operations", false);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs
similarity index 52%
rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs
rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs
index 40cf6e393054..9191a9ea3ef5 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs
@@ -15,43 +15,43 @@
namespace Azure.ResourceManager.Sql
{
- /// The ServiceTierAdvisors service client.
- public partial class ServiceTierAdvisorsOperations
+ /// The DatabaseSchemas service client.
+ public partial class DatabaseSchemasOperations
{
private readonly ClientDiagnostics _clientDiagnostics;
private readonly HttpPipeline _pipeline;
- internal ServiceTierAdvisorsRestOperations RestClient { get; }
+ internal DatabaseSchemasRestOperations RestClient { get; }
- /// Initializes a new instance of ServiceTierAdvisorsOperations for mocking.
- protected ServiceTierAdvisorsOperations()
+ /// Initializes a new instance of DatabaseSchemasOperations for mocking.
+ protected DatabaseSchemasOperations()
{
}
- /// Initializes a new instance of ServiceTierAdvisorsOperations.
+ /// Initializes a new instance of DatabaseSchemasOperations.
/// The handler for diagnostic messaging in the client.
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// The subscription ID that identifies an Azure subscription.
/// server parameter.
- internal ServiceTierAdvisorsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ internal DatabaseSchemasOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
{
- RestClient = new ServiceTierAdvisorsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ RestClient = new DatabaseSchemasRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
_clientDiagnostics = clientDiagnostics;
_pipeline = pipeline;
}
- /// Gets a service tier advisor.
+ /// Get database schema.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
- /// The name of database.
- /// The name of service tier advisor.
+ /// The name of the database.
+ /// The name of the schema.
/// The cancellation token to use.
- public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default)
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.Get");
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.Get");
scope.Start();
try
{
- return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, cancellationToken).ConfigureAwait(false);
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
@@ -60,19 +60,19 @@ public virtual async Task> GetAsync(string resource
}
}
- /// Gets a service tier advisor.
+ /// Get database schema.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
- /// The name of database.
- /// The name of service tier advisor.
+ /// The name of the database.
+ /// The name of the schema.
/// The cancellation token to use.
- public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default)
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default)
{
- using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.Get");
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.Get");
scope.Start();
try
{
- return RestClient.Get(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, cancellationToken);
+ return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, cancellationToken);
}
catch (Exception e)
{
@@ -81,13 +81,14 @@ public virtual Response Get(string resourceGroupName, string
}
}
- /// Returns service tier advisors for specified database.
+ /// List database schemas.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
- /// The name of database.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
/// The cancellation token to use.
/// , , or is null.
- public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -102,14 +103,14 @@ public virtual AsyncPageable ListByDatabaseAsync(string reso
throw new ArgumentNullException(nameof(databaseName));
}
- async Task> FirstPageFunc(int? pageSizeHint)
+ async Task> FirstPageFunc(int? pageSizeHint)
{
- using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.ListByDatabase");
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase");
scope.Start();
try
{
- var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
- return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
@@ -117,16 +118,32 @@ async Task> FirstPageFunc(int? pageSizeHint)
throw;
}
}
- return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
- /// Returns service tier advisors for specified database.
+ /// List database schemas.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
- /// The name of database.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
/// The cancellation token to use.
/// , , or is null.
- public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -141,14 +158,29 @@ public virtual Pageable ListByDatabase(string resourceGroupN
throw new ArgumentNullException(nameof(databaseName));
}
- Page FirstPageFunc(int? pageSizeHint)
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
{
- using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.ListByDatabase");
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase");
scope.Start();
try
{
- var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken);
- return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
@@ -156,7 +188,7 @@ Page FirstPageFunc(int? pageSizeHint)
throw;
}
}
- return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
}
}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs
new file mode 100644
index 000000000000..f1ec304eec06
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs
@@ -0,0 +1,354 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseSchemasRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseSchemasRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseSchemasRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas", false);
+ if (filter != null)
+ {
+ uri.AppendQuery("$filter", filter, true);
+ }
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database schemas.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchemaListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database schemas.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchemaListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas/", false);
+ uri.AppendPath(schemaName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Get database schema.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchema value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get database schema.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchema value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database schemas.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchemaListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database schemas.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSchemaListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs
new file mode 100644
index 000000000000..be6e5179e6a1
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs
@@ -0,0 +1,236 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseSecurityAlertPolicies service client.
+ public partial class DatabaseSecurityAlertPoliciesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseSecurityAlertPoliciesRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseSecurityAlertPoliciesOperations for mocking.
+ protected DatabaseSecurityAlertPoliciesOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseSecurityAlertPoliciesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseSecurityAlertPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseSecurityAlertPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Gets a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The database security alert policy.
+ /// The cancellation token to use.
+ public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates or updates a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The database security alert policy.
+ /// The cancellation token to use.
+ public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs
new file mode 100644
index 000000000000..1c94674abfb5
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs
@@ -0,0 +1,453 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseSecurityAlertPoliciesRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseSecurityAlertPoliciesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseSecurityAlertPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/securityAlertPolicies/", false);
+ uri.AppendPath(securityAlertPolicyName.ToString(), true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertPolicy value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertPolicy value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/securityAlertPolicies/", false);
+ uri.AppendPath(securityAlertPolicyName.ToString(), true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(parameters);
+ request.Content = content;
+ return message;
+ }
+
+ /// Creates or updates a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The database security alert policy.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ DatabaseSecurityAlertPolicy value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Creates or updates a database's security alert policy.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The name of the security alert policy.
+ /// The database security alert policy.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException(nameof(parameters));
+ }
+
+ using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ case 201:
+ {
+ DatabaseSecurityAlertPolicy value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/securityAlertPolicies", false);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets a list of database's security alert policies.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database for which the security alert policy is defined.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseSecurityAlertListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs
new file mode 100644
index 000000000000..fe2e5ff8df18
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs
@@ -0,0 +1,206 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ /// The DatabaseTables service client.
+ public partial class DatabaseTablesOperations
+ {
+ private readonly ClientDiagnostics _clientDiagnostics;
+ private readonly HttpPipeline _pipeline;
+ internal DatabaseTablesRestOperations RestClient { get; }
+
+ /// Initializes a new instance of DatabaseTablesOperations for mocking.
+ protected DatabaseTablesOperations()
+ {
+ }
+
+ /// Initializes a new instance of DatabaseTablesOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ internal DatabaseTablesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ RestClient = new DatabaseTablesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ /// Get database table.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.Get");
+ scope.Start();
+ try
+ {
+ return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Get database table.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The cancellation token to use.
+ public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.Get");
+ scope.Start();
+ try
+ {
+ return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, tableName, cancellationToken);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List database tables.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public virtual AsyncPageable ListBySchemaAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ async Task> FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListBySchemaNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
+ }
+
+ /// List database tables.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public virtual Pageable ListBySchema(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ Page FirstPageFunc(int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySchema(resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListBySchemaNextPage(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs
new file mode 100644
index 000000000000..3be3e716856e
--- /dev/null
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs
@@ -0,0 +1,388 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Sql.Models;
+
+namespace Azure.ResourceManager.Sql
+{
+ internal partial class DatabaseTablesRestOperations
+ {
+ private string subscriptionId;
+ private Uri endpoint;
+ private ClientDiagnostics _clientDiagnostics;
+ private HttpPipeline _pipeline;
+
+ /// Initializes a new instance of DatabaseTablesRestOperations.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The subscription ID that identifies an Azure subscription.
+ /// server parameter.
+ /// is null.
+ public DatabaseTablesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ endpoint ??= new Uri("https://management.azure.com");
+
+ this.subscriptionId = subscriptionId;
+ this.endpoint = endpoint;
+ _clientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ }
+
+ internal HttpMessage CreateListBySchemaRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas/", false);
+ uri.AppendPath(schemaName, true);
+ uri.AppendPath("/tables", false);
+ if (filter != null)
+ {
+ uri.AppendQuery("$filter", filter, true);
+ }
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database tables.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public async Task> ListBySchemaAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateListBySchemaRequest(resourceGroupName, serverName, databaseName, schemaName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTableListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database tables.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , or is null.
+ public Response ListBySchema(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateListBySchemaRequest(resourceGroupName, serverName, databaseName, schemaName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTableListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/resourceGroups/", false);
+ uri.AppendPath(resourceGroupName, true);
+ uri.AppendPath("/providers/Microsoft.Sql/servers/", false);
+ uri.AppendPath(serverName, true);
+ uri.AppendPath("/databases/", false);
+ uri.AppendPath(databaseName, true);
+ uri.AppendPath("/schemas/", false);
+ uri.AppendPath(schemaName, true);
+ uri.AppendPath("/tables/", false);
+ uri.AppendPath(tableName, true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Get database table.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTable value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseTable.DeserializeDatabaseTable(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Get database table.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// The name of the table.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default)
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+ if (tableName == null)
+ {
+ throw new ArgumentNullException(nameof(tableName));
+ }
+
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTable value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseTable.DeserializeDatabaseTable(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+
+ internal HttpMessage CreateListBySchemaNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// List database tables.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public async Task> ListBySchemaNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTableListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// List database tables.
+ /// The URL to the next page of results.
+ /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ /// The name of the server.
+ /// The name of the database.
+ /// The name of the schema.
+ /// An OData filter expression that filters elements in the collection.
+ /// The cancellation token to use.
+ /// , , , , or is null.
+ public Response ListBySchemaNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+ if (schemaName == null)
+ {
+ throw new ArgumentNullException(nameof(schemaName));
+ }
+
+ using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseTableListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs
deleted file mode 100644
index 4e549b00d0ef..000000000000
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Azure;
-using Azure.Core.Pipeline;
-using Azure.ResourceManager.Sql.Models;
-
-namespace Azure.ResourceManager.Sql
-{
- /// The DatabaseThreatDetectionPolicies service client.
- public partial class DatabaseThreatDetectionPoliciesOperations
- {
- private readonly ClientDiagnostics _clientDiagnostics;
- private readonly HttpPipeline _pipeline;
- internal DatabaseThreatDetectionPoliciesRestOperations RestClient { get; }
-
- /// Initializes a new instance of DatabaseThreatDetectionPoliciesOperations for mocking.
- protected DatabaseThreatDetectionPoliciesOperations()
- {
- }
-
- /// Initializes a new instance of DatabaseThreatDetectionPoliciesOperations.
- /// The handler for diagnostic messaging in the client.
- /// The HTTP pipeline for sending and receiving REST requests and responses.
- /// The subscription ID that identifies an Azure subscription.
- /// server parameter.
- internal DatabaseThreatDetectionPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null)
- {
- RestClient = new DatabaseThreatDetectionPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
- _clientDiagnostics = clientDiagnostics;
- _pipeline = pipeline;
- }
-
- /// Gets a database's threat detection policy.
- /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
- /// The name of the server.
- /// The name of the database for which database Threat Detection policy is defined.
- /// The name of the security alert policy.
- /// The cancellation token to use.
- public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
- {
- using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.Get");
- scope.Start();
- try
- {
- return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Gets a database's threat detection policy.
- /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
- /// The name of the server.
- /// The name of the database for which database Threat Detection policy is defined.
- /// The name of the security alert policy.
- /// The cancellation token to use.
- public virtual Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default)
- {
- using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.Get");
- scope.Start();
- try
- {
- return RestClient.Get(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Creates or updates a database's threat detection policy.
- /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
- /// The name of the server.
- /// The name of the database for which database Threat Detection policy is defined.
- /// The name of the security alert policy.
- /// The database Threat Detection policy.
- /// The cancellation token to use.
- public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
- {
- using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.CreateOrUpdate");
- scope.Start();
- try
- {
- return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken).ConfigureAwait(false);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
-
- /// Creates or updates a database's threat detection policy.
- /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
- /// The name of the server.
- /// The name of the database for which database Threat Detection policy is defined.
- /// The name of the security alert policy.
- /// The database Threat Detection policy.
- /// The cancellation token to use.
- public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default)
- {
- using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.CreateOrUpdate");
- scope.Start();
- try
- {
- return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken);
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
- }
-}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs
index 81330420b529..203e5f60552d 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs
@@ -39,7 +39,7 @@ internal DatabaseUsagesOperations(ClientDiagnostics clientDiagnostics, HttpPipel
_pipeline = pipeline;
}
- /// Returns database usages.
+ /// Gets database usages.
/// The name of the resource group 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.
@@ -67,7 +67,7 @@ async Task> FirstPageFunc(int? pageSizeHint)
try
{
var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
- return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
@@ -75,10 +75,25 @@ async Task> FirstPageFunc(int? pageSizeHint)
throw;
}
}
- return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
+ async Task> NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseUsagesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
- /// Returns database usages.
+ /// Gets database usages.
/// The name of the resource group 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.
@@ -106,7 +121,22 @@ Page FirstPageFunc(int? pageSizeHint)
try
{
var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken);
- return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ Page NextPageFunc(string nextLink, int? pageSizeHint)
+ {
+ using var scope = _clientDiagnostics.CreateScope("DatabaseUsagesOperations.ListByDatabase");
+ scope.Start();
+ try
+ {
+ var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken);
+ return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
@@ -114,7 +144,7 @@ Page FirstPageFunc(int? pageSizeHint)
throw;
}
}
- return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
+ return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
}
}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs
index f48beff085ad..40ca7d3bcee2 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs
@@ -59,13 +59,13 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/usages", false);
- uri.AppendQuery("api-version", "2014-04-01", true);
+ uri.AppendQuery("api-version", "2021-02-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
- /// Returns database usages.
+ /// Gets database usages.
/// The name of the resource group 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.
@@ -102,7 +102,7 @@ public async Task> ListByDatabaseAsync(string
}
}
- /// Returns database usages.
+ /// Gets database usages.
/// The name of the resource group 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.
@@ -138,5 +138,102 @@ public Response ListByDatabase(string resourceGroupName
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
+
+ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ /// Gets database usages.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 to use.
+ /// , , , or is null.
+ public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseUsageListResult value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = DatabaseUsageListResult.DeserializeDatabaseUsageListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
+ }
+ }
+
+ /// Gets database usages.
+ /// The URL to the next page of results.
+ /// The name of the resource group 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 to use.
+ /// , , , or is null.
+ public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
+ {
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException(nameof(nextLink));
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException(nameof(resourceGroupName));
+ }
+ if (serverName == null)
+ {
+ throw new ArgumentNullException(nameof(serverName));
+ }
+ if (databaseName == null)
+ {
+ throw new ArgumentNullException(nameof(databaseName));
+ }
+
+ using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ DatabaseUsageListResult value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = DatabaseUsageListResult.DeserializeDatabaseUsageListResult(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw _clientDiagnostics.CreateRequestFailedException(message.Response);
+ }
+ }
}
}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs
index c2d3697ec91b..101f2c948dd4 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs
@@ -64,7 +64,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(ruleId, true);
uri.AppendPath("/baselines/", false);
uri.AppendPath(baselineName.ToSerialString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -179,7 +179,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin
uri.AppendPath(ruleId, true);
uri.AppendPath("/baselines/", false);
uri.AppendPath(baselineName.ToSerialString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -308,7 +308,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server
uri.AppendPath(ruleId, true);
uri.AppendPath("/baselines/", false);
uri.AppendPath(baselineName.ToSerialString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
return message;
}
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs
index b9fd28eea8c3..759b7793d75d 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs
@@ -43,11 +43,11 @@ public DatabaseVulnerabilityAssessmentScansRestOperations(ClientDiagnostics clie
_pipeline = pipeline;
}
- internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName)
+ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
- request.Method = RequestMethod.Get;
+ request.Method = RequestMethod.Post;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
@@ -60,21 +60,23 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments/", false);
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
- uri.AppendPath("/scans", false);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendPath("/scans/", false);
+ uri.AppendPath(scanId, true);
+ uri.AppendPath("/initiateScan", false);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
return message;
}
- /// Lists the vulnerability assessment scans of a database.
+ /// Executes a Vulnerability Assessment database scan.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
/// The name of the vulnerability assessment.
+ /// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
- /// , , or is null.
- public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default)
+ /// , , , or is null.
+ public async Task InitiateScanAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -88,31 +90,32 @@ public async Task> ListByD
{
throw new ArgumentNullException(nameof(databaseName));
}
+ if (scanId == null)
+ {
+ throw new ArgumentNullException(nameof(scanId));
+ }
- using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName);
+ using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
- {
- VulnerabilityAssessmentScanRecordListResult value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
+ case 202:
+ return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
- /// Lists the vulnerability assessment scans of a database.
+ /// Executes a Vulnerability Assessment database scan.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
/// The name of the vulnerability assessment.
+ /// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
- /// , , or is null.
- public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default)
+ /// , , , or is null.
+ public Response InitiateScan(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -126,24 +129,24 @@ public Response ListByDatabase(stri
{
throw new ArgumentNullException(nameof(databaseName));
}
+ if (scanId == null)
+ {
+ throw new ArgumentNullException(nameof(scanId));
+ }
- using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName);
+ using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
- {
- VulnerabilityAssessmentScanRecordListResult value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
+ case 202:
+ return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
- internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId)
+ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
@@ -160,23 +163,21 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments/", false);
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
- uri.AppendPath("/scans/", false);
- uri.AppendPath(scanId, true);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendPath("/scans", false);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
- /// Gets a vulnerability assessment scan record of a database.
+ /// Lists the vulnerability assessment scans of a database.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
/// The name of the vulnerability assessment.
- /// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
- /// , , , or is null.
- public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
+ /// , , or is null.
+ public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -190,20 +191,16 @@ public async Task> GetAsync(string r
{
throw new ArgumentNullException(nameof(databaseName));
}
- if (scanId == null)
- {
- throw new ArgumentNullException(nameof(scanId));
- }
- using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
- VulnerabilityAssessmentScanRecord value = default;
+ VulnerabilityAssessmentScanRecordListResult value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement);
+ value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
@@ -211,15 +208,14 @@ public async Task> GetAsync(string r
}
}
- /// Gets a vulnerability assessment scan record of a database.
+ /// Lists the vulnerability assessment scans of a database.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
/// The name of the vulnerability assessment.
- /// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
- /// , , , or is null.
- public Response Get(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
+ /// , , or is null.
+ public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -233,20 +229,16 @@ public Response Get(string resourceGroupName,
{
throw new ArgumentNullException(nameof(databaseName));
}
- if (scanId == null)
- {
- throw new ArgumentNullException(nameof(scanId));
- }
- using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
+ using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
- VulnerabilityAssessmentScanRecord value = default;
+ VulnerabilityAssessmentScanRecordListResult value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement);
+ value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
@@ -254,11 +246,11 @@ public Response Get(string resourceGroupName,
}
}
- internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId)
+ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
- request.Method = RequestMethod.Post;
+ request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
@@ -273,13 +265,13 @@ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
uri.AppendPath("/scans/", false);
uri.AppendPath(scanId, true);
- uri.AppendPath("/initiateScan", false);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
return message;
}
- /// Executes a Vulnerability Assessment database scan.
+ /// Gets a vulnerability assessment scan record of a database.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
@@ -287,7 +279,7 @@ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string
/// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
/// , , , or is null.
- public async Task InitiateScanAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
+ public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -306,19 +298,23 @@ public async Task InitiateScanAsync(string resourceGroupName, string s
throw new ArgumentNullException(nameof(scanId));
}
- using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
- case 202:
- return message.Response;
+ {
+ VulnerabilityAssessmentScanRecord value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
- /// Executes a Vulnerability Assessment database scan.
+ /// Gets a vulnerability assessment scan record of a database.
/// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
/// The name of the server.
/// The name of the database.
@@ -326,7 +322,7 @@ public async Task InitiateScanAsync(string resourceGroupName, string s
/// The vulnerability assessment scan Id of the scan to retrieve.
/// The cancellation token to use.
/// , , , or is null.
- public Response InitiateScan(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
+ public Response Get(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
@@ -345,13 +341,17 @@ public Response InitiateScan(string resourceGroupName, string serverName, string
throw new ArgumentNullException(nameof(scanId));
}
- using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
+ using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
- case 202:
- return message.Response;
+ {
+ VulnerabilityAssessmentScanRecord value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
@@ -377,7 +377,7 @@ internal HttpMessage CreateExportRequest(string resourceGroupName, string server
uri.AppendPath("/scans/", false);
uri.AppendPath(scanId, true);
uri.AppendPath("/export", false);
- uri.AppendQuery("api-version", "2017-10-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs
index 5dcb7527798d..3d3679dd7d50 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs
@@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments/", false);
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
@@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments/", false);
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Content-Type", "application/json");
@@ -274,7 +274,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments/", false);
uri.AppendPath(vulnerabilityAssessmentName.ToString(), true);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
return message;
}
@@ -361,7 +361,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin
uri.AppendPath("/databases/", false);
uri.AppendPath(databaseName, true);
uri.AppendPath("/vulnerabilityAssessments", false);
- uri.AppendQuery("api-version", "2017-03-01-preview", true);
+ uri.AppendQuery("api-version", "2020-11-01-preview", true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs
index 9e8c227f8be0..67d907584cec 100644
--- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs
+++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs
@@ -16,10 +16,10 @@
namespace Azure.ResourceManager.Sql
{
- /// Exports a database to a bacpac.
- public partial class DatabasesExportOperation : Operation, IOperationSource
+ /// Exports a database.
+ public partial class DatabasesExportOperation : Operation, IOperationSource
{
- private readonly ArmOperationHelpers _operation;
+ private readonly ArmOperationHelpers _operation;
/// Initializes a new instance of DatabasesExportOperation for mocking.
protected DatabasesExportOperation()
@@ -28,13 +28,13 @@ protected DatabasesExportOperation()
internal DatabasesExportOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
{
- _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesExportOperation");
+ _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesExportOperation");
}
///
public override string Id => _operation.Id;
///
- public override ImportExportResponse Value => _operation.Value;
+ public override ImportExportOperationResult Value => _operation.Value;
///
public override bool HasCompleted => _operation.HasCompleted;
@@ -52,21 +52,21 @@ internal DatabasesExportOperation(ClientDiagnostics clientDiagnostics, HttpPipel
public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
///
- public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
+ public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
///