diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPolicyData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPolicyData.cs index bcda96f231642..5ff208109bcef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPolicyData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPolicyData.cs @@ -62,10 +62,6 @@ public DatabaseBlobAuditingPolicyData() /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -111,7 +107,6 @@ public DatabaseBlobAuditingPolicyData() /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - /// Specifies whether Managed Identity is used to access blob storage. /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. /// @@ -123,7 +118,7 @@ public DatabaseBlobAuditingPolicyData() /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// /// Specifies the blob storage subscription Id. - internal DatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, bool? isManagedIdentityInUse, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) + internal DatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) { Kind = kind; RetentionDays = retentionDays; @@ -131,7 +126,6 @@ internal DatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, Reso IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; - IsManagedIdentityInUse = isManagedIdentityInUse; State = state; StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; @@ -175,10 +169,6 @@ internal DatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, Reso /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -228,8 +218,6 @@ internal DatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, Reso /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } - /// Specifies whether Managed Identity is used to access blob storage. - public bool? IsManagedIdentityInUse { get; set; } /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. public BlobAuditingPolicyState? State { get; set; } /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyData.cs index 3656fa1b70c2e..2f7185dc9a1fa 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyData.cs @@ -62,10 +62,6 @@ public ExtendedDatabaseBlobAuditingPolicyData() /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -111,7 +107,6 @@ public ExtendedDatabaseBlobAuditingPolicyData() /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - /// Specifies whether Managed Identity is used to access blob storage. /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. /// @@ -123,7 +118,7 @@ public ExtendedDatabaseBlobAuditingPolicyData() /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// /// Specifies the blob storage subscription Id. - internal ExtendedDatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, bool? isManagedIdentityInUse, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) + internal ExtendedDatabaseBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) { PredicateExpression = predicateExpression; RetentionDays = retentionDays; @@ -131,7 +126,6 @@ internal ExtendedDatabaseBlobAuditingPolicyData(ResourceIdentifier id, string na IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; - IsManagedIdentityInUse = isManagedIdentityInUse; State = state; StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; @@ -175,10 +169,6 @@ internal ExtendedDatabaseBlobAuditingPolicyData(ResourceIdentifier id, string na /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -228,8 +218,6 @@ internal ExtendedDatabaseBlobAuditingPolicyData(ResourceIdentifier id, string na /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } - /// Specifies whether Managed Identity is used to access blob storage. - public bool? IsManagedIdentityInUse { get; set; } /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. public BlobAuditingPolicyState? State { get; set; } /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyData.cs index 9a842d9172286..ff2460a1677c1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyData.cs @@ -75,10 +75,6 @@ public ExtendedServerBlobAuditingPolicyData() /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -124,7 +120,6 @@ public ExtendedServerBlobAuditingPolicyData() /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - /// Specifies whether Managed Identity is used to access blob storage. /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. /// @@ -136,7 +131,7 @@ public ExtendedServerBlobAuditingPolicyData() /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// /// Specifies the blob storage subscription Id. - internal ExtendedServerBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isDevopsAuditEnabled, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, bool? isManagedIdentityInUse, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) + internal ExtendedServerBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isDevopsAuditEnabled, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) { IsDevopsAuditEnabled = isDevopsAuditEnabled; PredicateExpression = predicateExpression; @@ -145,7 +140,6 @@ internal ExtendedServerBlobAuditingPolicyData(ResourceIdentifier id, string name IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; - IsManagedIdentityInUse = isManagedIdentityInUse; State = state; StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; @@ -203,10 +197,6 @@ internal ExtendedServerBlobAuditingPolicyData(ResourceIdentifier id, string name /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -256,8 +246,6 @@ internal ExtendedServerBlobAuditingPolicyData(ResourceIdentifier id, string name /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } - /// Specifies whether Managed Identity is used to access blob storage. - public bool? IsManagedIdentityInUse { get; set; } /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. public BlobAuditingPolicyState? State { get; set; } /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index 5d4326f6b2386..f0ed48c25031f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -1326,6 +1326,82 @@ public static ServiceObjectiveResource GetServiceObjectiveResource(this ArmClien } #endregion + #region ExtendedDatabaseBlobAuditingPolicyResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ExtendedDatabaseBlobAuditingPolicyResource GetExtendedDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ExtendedDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); + return new ExtendedDatabaseBlobAuditingPolicyResource(client, id); + } + ); + } + #endregion + + #region ExtendedServerBlobAuditingPolicyResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ExtendedServerBlobAuditingPolicyResource GetExtendedServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new ExtendedServerBlobAuditingPolicyResource(client, id); + } + ); + } + #endregion + + #region ServerBlobAuditingPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerBlobAuditingPolicyResource GetServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new ServerBlobAuditingPolicyResource(client, id); + } + ); + } + #endregion + + #region DatabaseBlobAuditingPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DatabaseBlobAuditingPolicyResource GetDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DatabaseBlobAuditingPolicyResource.ValidateResourceId(id); + return new DatabaseBlobAuditingPolicyResource(client, id); + } + ); + } + #endregion + #region ServerDatabaseAdvisorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3112,25 +3188,6 @@ public static IPv6FirewallRuleResource GetIPv6FirewallRuleResource(this ArmClien } #endregion - #region EndpointCertificateResource - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static EndpointCertificateResource GetEndpointCertificateResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - EndpointCertificateResource.ValidateResourceId(id); - return new EndpointCertificateResource(client, id); - } - ); - } - #endregion - #region ReplicationLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3188,77 +3245,58 @@ public static ServerDatabaseSchemaTableColumnSensitivityLabelResource GetServerD } #endregion - #region ServerBlobAuditingPolicyResource + #region ManagedServerDnsAliasResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ServerBlobAuditingPolicyResource GetServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ManagedServerDnsAliasResource GetManagedServerDnsAliasResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new ServerBlobAuditingPolicyResource(client, id); + ManagedServerDnsAliasResource.ValidateResourceId(id); + return new ManagedServerDnsAliasResource(client, id); } ); } #endregion - #region DatabaseBlobAuditingPolicyResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DatabaseBlobAuditingPolicyResource GetDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DatabaseBlobAuditingPolicyResource.ValidateResourceId(id); - return new DatabaseBlobAuditingPolicyResource(client, id); - } - ); - } - #endregion - - #region ExtendedDatabaseBlobAuditingPolicyResource + #region EndpointCertificateResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ExtendedDatabaseBlobAuditingPolicyResource GetExtendedDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static EndpointCertificateResource GetEndpointCertificateResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ExtendedDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); - return new ExtendedDatabaseBlobAuditingPolicyResource(client, id); + EndpointCertificateResource.ValidateResourceId(id); + return new EndpointCertificateResource(client, id); } ); } #endregion - #region ExtendedServerBlobAuditingPolicyResource + #region ManagedInstanceDtcResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ExtendedServerBlobAuditingPolicyResource GetExtendedServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ManagedInstanceDtcResource GetManagedInstanceDtcResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new ExtendedServerBlobAuditingPolicyResource(client, id); + ManagedInstanceDtcResource.ValidateResourceId(id); + return new ManagedInstanceDtcResource(client, id); } ); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedInstanceDtcOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedInstanceDtcOperationSource.cs new file mode 100644 index 0000000000000..0e886d6fc59f6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedInstanceDtcOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class ManagedInstanceDtcOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedInstanceDtcOperationSource(ArmClient client) + { + _client = client; + } + + ManagedInstanceDtcResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedInstanceDtcData.DeserializeManagedInstanceDtcData(document.RootElement); + return new ManagedInstanceDtcResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedInstanceDtcData.DeserializeManagedInstanceDtcData(document.RootElement); + return new ManagedInstanceDtcResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs new file mode 100644 index 0000000000000..1584715c6788b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/ManagedServerDnsAliasOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class ManagedServerDnsAliasOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedServerDnsAliasOperationSource(ArmClient client) + { + _client = client; + } + + ManagedServerDnsAliasResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return new ManagedServerDnsAliasResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return new ManagedServerDnsAliasResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs index 6b4fe249b2bbc..a294dbb64dbc6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs @@ -1186,6 +1186,92 @@ public virtual Response UpdateRecommendedManagedDatabaseSensitivityLabel(Recomme } } + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: ManagedDatabaseSensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedDatabaseSensitivityLabelsByDatabaseAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = await _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = await _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: ManagedDatabaseSensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedDatabaseSensitivityLabelsByDatabase(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsClientDiagnostics.CreateScope("ManagedDatabaseResource.GetManagedDatabaseSensitivityLabelsByDatabase"); + scope.Start(); + try + { + var response = _managedInstanceDatabaseSchemaTableColumnSensitivityLabelManagedDatabaseSensitivityLabelsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs new file mode 100644 index 0000000000000..e901bc3ce6c5c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcCollection.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedInstanceDtcs method from an instance of . + /// + public partial class ManagedInstanceDtcCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedInstanceDtcClientDiagnostics; + private readonly ManagedInstanceDtcsRestOperations _managedInstanceDtcRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedInstanceDtcCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedInstanceDtcCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedInstanceDtcClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceDtcResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedInstanceDtcResource.ResourceType, out string managedInstanceDtcApiVersion); + _managedInstanceDtcRestClient = new ManagedInstanceDtcsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedInstanceDtcApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Updates managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the managed instance DTC. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, DtcName dtcName, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedInstanceDtcOperationSource(Client), _managedInstanceDtcClientDiagnostics, Pipeline, _managedInstanceDtcRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the managed instance DTC. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, DtcName dtcName, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, data, cancellationToken); + var operation = new SqlArmOperation(new ManagedInstanceDtcOperationSource(Client), _managedInstanceDtcClientDiagnostics, Pipeline, _managedInstanceDtcRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual async Task> GetAsync(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.Get"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual Response Get(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.Get"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc + /// Operation Id: ManagedInstanceDtcs_ListByManagedInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.ListByManagedInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDtcResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.ListByManagedInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDtcResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc + /// Operation Id: ManagedInstanceDtcs_ListByManagedInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetAll"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.ListByManagedInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDtcResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.GetAll"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.ListByManagedInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedInstanceDtcResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.Exists"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + public virtual Response Exists(DtcName dtcName, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcCollection.Exists"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dtcName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcData.cs new file mode 100644 index 0000000000000..ea6bbb5c299e2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcData.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the ManagedInstanceDtc data model. + public partial class ManagedInstanceDtcData : ResourceData + { + /// Initializes a new instance of ManagedInstanceDtcData. + public ManagedInstanceDtcData() + { + ExternalDnsSuffixSearchList = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstanceDtcData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Active status of managed instance DTC. + /// Security settings of managed instance DTC. + /// External dns suffix search list of managed instance DTC. + /// Host name dns suffix of managed instance DTC. + /// Provisioning state of managed instance DTC. + internal ManagedInstanceDtcData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? dtcEnabled, ManagedInstanceDtcSecuritySettings securitySettings, IList externalDnsSuffixSearchList, string dtcHostNameDnsSuffix, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + DtcEnabled = dtcEnabled; + SecuritySettings = securitySettings; + ExternalDnsSuffixSearchList = externalDnsSuffixSearchList; + DtcHostNameDnsSuffix = dtcHostNameDnsSuffix; + ProvisioningState = provisioningState; + } + + /// Active status of managed instance DTC. + public bool? DtcEnabled { get; set; } + /// Security settings of managed instance DTC. + public ManagedInstanceDtcSecuritySettings SecuritySettings { get; set; } + /// External dns suffix search list of managed instance DTC. + public IList ExternalDnsSuffixSearchList { get; } + /// Host name dns suffix of managed instance DTC. + public string DtcHostNameDnsSuffix { get; } + /// Provisioning state of managed instance DTC. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs new file mode 100644 index 0000000000000..0eaa32fc3727b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a ManagedInstanceDtc along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedInstanceDtcResource method. + /// Otherwise you can get one from its parent resource using the GetManagedInstanceDtc method. + /// + public partial class ManagedInstanceDtcResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string dtcName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedInstanceDtcClientDiagnostics; + private readonly ManagedInstanceDtcsRestOperations _managedInstanceDtcRestClient; + private readonly ManagedInstanceDtcData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedInstanceDtcResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedInstanceDtcResource(ArmClient client, ManagedInstanceDtcData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedInstanceDtcResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedInstanceDtcClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedInstanceDtcApiVersion); + _managedInstanceDtcRestClient = new ManagedInstanceDtcsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedInstanceDtcApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/dtc"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ManagedInstanceDtcData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcResource.Get"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcResource.Get"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedInstanceDtcResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcResource.Update"); + scope.Start(); + try + { + var response = await _managedInstanceDtcRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedInstanceDtcOperationSource(Client), _managedInstanceDtcClientDiagnostics, Pipeline, _managedInstanceDtcRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedInstanceDtcClientDiagnostics.CreateScope("ManagedInstanceDtcResource.Update"); + scope.Start(); + try + { + var response = _managedInstanceDtcRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(new ManagedInstanceDtcOperationSource(Client), _managedInstanceDtcClientDiagnostics, Pipeline, _managedInstanceDtcRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index 2fe56def57db8..d5772d4abc58e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -605,6 +605,43 @@ public virtual Response GetServerTrustCertificat return GetServerTrustCertificates().Get(certificateName, cancellationToken); } + /// Gets a collection of ManagedServerDnsAliasResources in the ManagedInstance. + /// An object representing collection of ManagedServerDnsAliasResources and their operations over a ManagedServerDnsAliasResource. + public virtual ManagedServerDnsAliasCollection GetManagedServerDnsAliases() + { + return GetCachedClient(Client => new ManagedServerDnsAliasCollection(Client, Id)); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetManagedServerDnsAliasAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + return await GetManagedServerDnsAliases().GetAsync(dnsAliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetManagedServerDnsAlias(string dnsAliasName, CancellationToken cancellationToken = default) + { + return GetManagedServerDnsAliases().Get(dnsAliasName, cancellationToken); + } + /// Gets a collection of EndpointCertificateResources in the ManagedInstance. /// An object representing collection of EndpointCertificateResources and their operations over a EndpointCertificateResource. public virtual EndpointCertificateCollection GetEndpointCertificates() @@ -642,6 +679,39 @@ public virtual Response GetEndpointCertificate(stri return GetEndpointCertificates().Get(endpointType, cancellationToken); } + /// Gets a collection of ManagedInstanceDtcResources in the ManagedInstance. + /// An object representing collection of ManagedInstanceDtcResources and their operations over a ManagedInstanceDtcResource. + public virtual ManagedInstanceDtcCollection GetManagedInstanceDtcs() + { + return GetCachedClient(Client => new ManagedInstanceDtcCollection(Client, Id)); + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetManagedInstanceDtcAsync(DtcName dtcName, CancellationToken cancellationToken = default) + { + return await GetManagedInstanceDtcs().GetAsync(dtcName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets managed instance DTC settings. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName} + /// Operation Id: ManagedInstanceDtcs_Get + /// + /// The name of the managed instance DTC. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetManagedInstanceDtc(DtcName dtcName, CancellationToken cancellationToken = default) + { + return GetManagedInstanceDtcs().Get(dtcName, cancellationToken); + } + /// /// Gets a managed instance. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs new file mode 100644 index 0000000000000..b47ab39a23052 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasCollection.cs @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedServerDnsAliases method from an instance of . + /// + public partial class ManagedServerDnsAliasCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedServerDnsAliasClientDiagnostics; + private readonly ManagedServerDnsAliasesRestOperations _managedServerDnsAliasRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedServerDnsAliasCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedServerDnsAliasCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedServerDnsAliasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedServerDnsAliasResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedServerDnsAliasResource.ResourceType, out string managedServerDnsAliasApiVersion); + _managedServerDnsAliasRestClient = new ManagedServerDnsAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedServerDnsAliasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedInstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedInstanceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content, cancellationToken); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Get"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Get"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases + /// Operation Id: ManagedServerDnsAliases_ListByManagedInstance + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.ListByManagedInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.ListByManagedInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases + /// Operation Id: ManagedServerDnsAliases_ListByManagedInstance + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.ListByManagedInstance(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.GetAll"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.ListByManagedInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ManagedServerDnsAliasResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Exists"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The String to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasCollection.Exists"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsAliasName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs new file mode 100644 index 0000000000000..c3310c9b69640 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + /// A class representing the ManagedServerDnsAlias data model. + public partial class ManagedServerDnsAliasData : ResourceData + { + /// Initializes a new instance of ManagedServerDnsAliasData. + public ManagedServerDnsAliasData() + { + } + + /// Initializes a new instance of ManagedServerDnsAliasData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The fully qualified DNS record for managed server alias. + internal ManagedServerDnsAliasData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string azureDnsRecord) : base(id, name, resourceType, systemData) + { + AzureDnsRecord = azureDnsRecord; + } + + /// The fully qualified DNS record for managed server alias. + public string AzureDnsRecord { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs new file mode 100644 index 0000000000000..138ea4c42da8d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a ManagedServerDnsAlias along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedServerDnsAliasResource method. + /// Otherwise you can get one from its parent resource using the GetManagedServerDnsAlias method. + /// + public partial class ManagedServerDnsAliasResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedServerDnsAliasClientDiagnostics; + private readonly ManagedServerDnsAliasesRestOperations _managedServerDnsAliasRestClient; + private readonly ManagedServerDnsAliasData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedServerDnsAliasResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedServerDnsAliasResource(ArmClient client, ManagedServerDnsAliasData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedServerDnsAliasResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedServerDnsAliasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedServerDnsAliasApiVersion); + _managedServerDnsAliasRestClient = new ManagedServerDnsAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedServerDnsAliasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/managedInstances/dnsAliases"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ManagedServerDnsAliasData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Get"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Get"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedServerDnsAliasResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Delete"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Delete"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Update"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a managed server DNS alias. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName} + /// Operation Id: ManagedServerDnsAliases_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Update"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire + /// Operation Id: ManagedServerDnsAliases_Acquire + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> AcquireAsync(WaitUntil waitUntil, ManagedServerDnsAliasAcquisition managedServerDnsAliasAcquisition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managedServerDnsAliasAcquisition, nameof(managedServerDnsAliasAcquisition)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Acquire"); + scope.Start(); + try + { + var response = await _managedServerDnsAliasRestClient.AcquireAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedServerDnsAliasAcquisition, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateAcquireRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedServerDnsAliasAcquisition).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire + /// Operation Id: ManagedServerDnsAliases_Acquire + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Acquire(WaitUntil waitUntil, ManagedServerDnsAliasAcquisition managedServerDnsAliasAcquisition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managedServerDnsAliasAcquisition, nameof(managedServerDnsAliasAcquisition)); + + using var scope = _managedServerDnsAliasClientDiagnostics.CreateScope("ManagedServerDnsAliasResource.Acquire"); + scope.Start(); + try + { + var response = _managedServerDnsAliasRestClient.Acquire(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedServerDnsAliasAcquisition, cancellationToken); + var operation = new SqlArmOperation(new ManagedServerDnsAliasOperationSource(Client), _managedServerDnsAliasClientDiagnostics, Pipeline, _managedServerDnsAliasRestClient.CreateAcquireRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, managedServerDnsAliasAcquisition).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicyData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicyData.Serialization.cs index b4c218b434f5d..38c7fe5e1485c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicyData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicyData.Serialization.cs @@ -51,11 +51,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } - if (Optional.IsDefined(IsManagedIdentityInUse)) - { - writer.WritePropertyName("isManagedIdentityInUse"); - writer.WriteBooleanValue(IsManagedIdentityInUse.Value); - } if (Optional.IsDefined(State)) { writer.WritePropertyName("state"); @@ -92,7 +87,6 @@ internal static DatabaseBlobAuditingPolicyData DeserializeDatabaseBlobAuditingPo Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; - Optional isManagedIdentityInUse = default; Optional state = default; Optional storageEndpoint = default; Optional storageAccountAccessKey = default; @@ -188,16 +182,6 @@ internal static DatabaseBlobAuditingPolicyData DeserializeDatabaseBlobAuditingPo queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("isManagedIdentityInUse")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isManagedIdentityInUse = property0.Value.GetBoolean(); - continue; - } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -232,7 +216,7 @@ internal static DatabaseBlobAuditingPolicyData DeserializeDatabaseBlobAuditingPo continue; } } - return new DatabaseBlobAuditingPolicyData(id, name, type, systemData, kind.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(isManagedIdentityInUse), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); + return new DatabaseBlobAuditingPolicyData(id, name, type, systemData, kind.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DtcName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DtcName.cs new file mode 100644 index 0000000000000..780a7763c2a03 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DtcName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The DtcName. + public readonly partial struct DtcName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DtcName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "current"; + + /// current. + public static DtcName Current { get; } = new DtcName(CurrentValue); + /// Determines if two values are the same. + public static bool operator ==(DtcName left, DtcName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DtcName left, DtcName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DtcName(string value) => new DtcName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DtcName other && Equals(other); + /// + public bool Equals(DtcName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicyData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicyData.Serialization.cs index 656e5c1a6d3b8..a35259d978e21 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicyData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicyData.Serialization.cs @@ -56,11 +56,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } - if (Optional.IsDefined(IsManagedIdentityInUse)) - { - writer.WritePropertyName("isManagedIdentityInUse"); - writer.WriteBooleanValue(IsManagedIdentityInUse.Value); - } if (Optional.IsDefined(State)) { writer.WritePropertyName("state"); @@ -97,7 +92,6 @@ internal static ExtendedDatabaseBlobAuditingPolicyData DeserializeExtendedDataba Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; - Optional isManagedIdentityInUse = default; Optional state = default; Optional storageEndpoint = default; Optional storageAccountAccessKey = default; @@ -193,16 +187,6 @@ internal static ExtendedDatabaseBlobAuditingPolicyData DeserializeExtendedDataba queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("isManagedIdentityInUse")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isManagedIdentityInUse = property0.Value.GetBoolean(); - continue; - } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -237,7 +221,7 @@ internal static ExtendedDatabaseBlobAuditingPolicyData DeserializeExtendedDataba continue; } } - return new ExtendedDatabaseBlobAuditingPolicyData(id, name, type, systemData, predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(isManagedIdentityInUse), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); + return new ExtendedDatabaseBlobAuditingPolicyData(id, name, type, systemData, predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicyData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicyData.Serialization.cs index e60a9f88fa755..114a10603adc6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicyData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicyData.Serialization.cs @@ -61,11 +61,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } - if (Optional.IsDefined(IsManagedIdentityInUse)) - { - writer.WritePropertyName("isManagedIdentityInUse"); - writer.WriteBooleanValue(IsManagedIdentityInUse.Value); - } if (Optional.IsDefined(State)) { writer.WritePropertyName("state"); @@ -103,7 +98,6 @@ internal static ExtendedServerBlobAuditingPolicyData DeserializeExtendedServerBl Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; - Optional isManagedIdentityInUse = default; Optional state = default; Optional storageEndpoint = default; Optional storageAccountAccessKey = default; @@ -209,16 +203,6 @@ internal static ExtendedServerBlobAuditingPolicyData DeserializeExtendedServerBl queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("isManagedIdentityInUse")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isManagedIdentityInUse = property0.Value.GetBoolean(); - continue; - } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -253,7 +237,7 @@ internal static ExtendedServerBlobAuditingPolicyData DeserializeExtendedServerBl continue; } } - return new ExtendedServerBlobAuditingPolicyData(id, name, type, systemData, Optional.ToNullable(isDevopsAuditEnabled), predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(isManagedIdentityInUse), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); + return new ExtendedServerBlobAuditingPolicyData(id, name, type, systemData, Optional.ToNullable(isDevopsAuditEnabled), predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcData.Serialization.cs new file mode 100644 index 0000000000000..82cbf088b97ef --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcData.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class ManagedInstanceDtcData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DtcEnabled)) + { + writer.WritePropertyName("dtcEnabled"); + writer.WriteBooleanValue(DtcEnabled.Value); + } + if (Optional.IsDefined(SecuritySettings)) + { + writer.WritePropertyName("securitySettings"); + writer.WriteObjectValue(SecuritySettings); + } + if (Optional.IsCollectionDefined(ExternalDnsSuffixSearchList)) + { + writer.WritePropertyName("externalDnsSuffixSearchList"); + writer.WriteStartArray(); + foreach (var item in ExternalDnsSuffixSearchList) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedInstanceDtcData DeserializeManagedInstanceDtcData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + Optional dtcEnabled = default; + Optional securitySettings = default; + Optional> externalDnsSuffixSearchList = default; + Optional dtcHostNameDnsSuffix = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("dtcEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + dtcEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("securitySettings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + securitySettings = ManagedInstanceDtcSecuritySettings.DeserializeManagedInstanceDtcSecuritySettings(property0.Value); + continue; + } + if (property0.NameEquals("externalDnsSuffixSearchList")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + externalDnsSuffixSearchList = array; + continue; + } + if (property0.NameEquals("dtcHostNameDnsSuffix")) + { + dtcHostNameDnsSuffix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new ManagedInstanceDtcData(id, name, type, systemData, Optional.ToNullable(dtcEnabled), securitySettings.Value, Optional.ToList(externalDnsSuffixSearchList), dtcHostNameDnsSuffix.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.Serialization.cs new file mode 100644 index 0000000000000..6a9d9717abd7c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedInstanceDtcListResult + { + internal static ManagedInstanceDtcListResult DeserializeManagedInstanceDtcListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedInstanceDtcData.DeserializeManagedInstanceDtcData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedInstanceDtcListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.cs new file mode 100644 index 0000000000000..1894cd8a5682e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of managed instance's DTCs. + internal partial class ManagedInstanceDtcListResult + { + /// Initializes a new instance of ManagedInstanceDtcListResult. + internal ManagedInstanceDtcListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstanceDtcListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedInstanceDtcListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.Serialization.cs new file mode 100644 index 0000000000000..dc9a65b3c1dc7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceDtcSecuritySettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TransactionManagerCommunicationSettings)) + { + writer.WritePropertyName("transactionManagerCommunicationSettings"); + writer.WriteObjectValue(TransactionManagerCommunicationSettings); + } + if (Optional.IsDefined(XaTransactionsEnabled)) + { + writer.WritePropertyName("xaTransactionsEnabled"); + writer.WriteBooleanValue(XaTransactionsEnabled.Value); + } + if (Optional.IsDefined(SnaLu6Point2TransactionsEnabled)) + { + writer.WritePropertyName("snaLu6point2TransactionsEnabled"); + writer.WriteBooleanValue(SnaLu6Point2TransactionsEnabled.Value); + } + writer.WriteEndObject(); + } + + internal static ManagedInstanceDtcSecuritySettings DeserializeManagedInstanceDtcSecuritySettings(JsonElement element) + { + Optional transactionManagerCommunicationSettings = default; + Optional xaTransactionsEnabled = default; + Optional snaLu6point2TransactionsEnabled = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("transactionManagerCommunicationSettings")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + transactionManagerCommunicationSettings = ManagedInstanceDtcTransactionManagerCommunicationSettings.DeserializeManagedInstanceDtcTransactionManagerCommunicationSettings(property.Value); + continue; + } + if (property.NameEquals("xaTransactionsEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + xaTransactionsEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("snaLu6point2TransactionsEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + snaLu6point2TransactionsEnabled = property.Value.GetBoolean(); + continue; + } + } + return new ManagedInstanceDtcSecuritySettings(transactionManagerCommunicationSettings.Value, Optional.ToNullable(xaTransactionsEnabled), Optional.ToNullable(snaLu6point2TransactionsEnabled)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.cs new file mode 100644 index 0000000000000..a5fa99b4e9fc2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcSecuritySettings.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The Security Settings of managed instance DTC. + public partial class ManagedInstanceDtcSecuritySettings + { + /// Initializes a new instance of ManagedInstanceDtcSecuritySettings. + public ManagedInstanceDtcSecuritySettings() + { + } + + /// Initializes a new instance of ManagedInstanceDtcSecuritySettings. + /// Transaction Manager communication settings of managed instance DTC. + /// Allow XA Transactions to managed instance DTC. + /// Allow SNA LU 6.2 to managed instance DTC. + internal ManagedInstanceDtcSecuritySettings(ManagedInstanceDtcTransactionManagerCommunicationSettings transactionManagerCommunicationSettings, bool? xaTransactionsEnabled, bool? snaLu6Point2TransactionsEnabled) + { + TransactionManagerCommunicationSettings = transactionManagerCommunicationSettings; + XaTransactionsEnabled = xaTransactionsEnabled; + SnaLu6Point2TransactionsEnabled = snaLu6Point2TransactionsEnabled; + } + + /// Transaction Manager communication settings of managed instance DTC. + public ManagedInstanceDtcTransactionManagerCommunicationSettings TransactionManagerCommunicationSettings { get; set; } + /// Allow XA Transactions to managed instance DTC. + public bool? XaTransactionsEnabled { get; set; } + /// Allow SNA LU 6.2 to managed instance DTC. + public bool? SnaLu6Point2TransactionsEnabled { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.Serialization.cs new file mode 100644 index 0000000000000..ed27fa771e3db --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceDtcTransactionManagerCommunicationSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AllowInboundEnabled)) + { + writer.WritePropertyName("allowInboundEnabled"); + writer.WriteBooleanValue(AllowInboundEnabled.Value); + } + if (Optional.IsDefined(AllowOutboundEnabled)) + { + writer.WritePropertyName("allowOutboundEnabled"); + writer.WriteBooleanValue(AllowOutboundEnabled.Value); + } + if (Optional.IsDefined(Authentication)) + { + writer.WritePropertyName("authentication"); + writer.WriteStringValue(Authentication); + } + writer.WriteEndObject(); + } + + internal static ManagedInstanceDtcTransactionManagerCommunicationSettings DeserializeManagedInstanceDtcTransactionManagerCommunicationSettings(JsonElement element) + { + Optional allowInboundEnabled = default; + Optional allowOutboundEnabled = default; + Optional authentication = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowInboundEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + allowInboundEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("allowOutboundEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + allowOutboundEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("authentication")) + { + authentication = property.Value.GetString(); + continue; + } + } + return new ManagedInstanceDtcTransactionManagerCommunicationSettings(Optional.ToNullable(allowInboundEnabled), Optional.ToNullable(allowOutboundEnabled), authentication.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.cs new file mode 100644 index 0000000000000..e30c90fc6b81d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDtcTransactionManagerCommunicationSettings.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The Transaction Manager Communication Settings of managed instance DTC. + public partial class ManagedInstanceDtcTransactionManagerCommunicationSettings + { + /// Initializes a new instance of ManagedInstanceDtcTransactionManagerCommunicationSettings. + public ManagedInstanceDtcTransactionManagerCommunicationSettings() + { + } + + /// Initializes a new instance of ManagedInstanceDtcTransactionManagerCommunicationSettings. + /// Allow Inbound traffic to managed instance DTC. + /// Allow Outbound traffic of managed instance DTC. + /// Authentication type of managed instance DTC. + internal ManagedInstanceDtcTransactionManagerCommunicationSettings(bool? allowInboundEnabled, bool? allowOutboundEnabled, string authentication) + { + AllowInboundEnabled = allowInboundEnabled; + AllowOutboundEnabled = allowOutboundEnabled; + Authentication = authentication; + } + + /// Allow Inbound traffic to managed instance DTC. + public bool? AllowInboundEnabled { get; set; } + /// Allow Outbound traffic of managed instance DTC. + public bool? AllowOutboundEnabled { get; set; } + /// Authentication type of managed instance DTC. + public string Authentication { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.Serialization.cs new file mode 100644 index 0000000000000..f6f504c743017 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedServerDnsAliasAcquisition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("oldManagedServerDnsAliasResourceId"); + writer.WriteStringValue(OldManagedServerDnsAliasResourceId); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs new file mode 100644 index 0000000000000..ee2523711b52a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A managed server DNS alias acquisition request. + public partial class ManagedServerDnsAliasAcquisition + { + /// Initializes a new instance of ManagedServerDnsAliasAcquisition. + /// The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + /// is null. + public ManagedServerDnsAliasAcquisition(string oldManagedServerDnsAliasResourceId) + { + if (oldManagedServerDnsAliasResourceId == null) + { + throw new ArgumentNullException(nameof(oldManagedServerDnsAliasResourceId)); + } + + OldManagedServerDnsAliasResourceId = oldManagedServerDnsAliasResourceId; + } + + /// The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + public string OldManagedServerDnsAliasResourceId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs new file mode 100644 index 0000000000000..93fe57797c41e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedServerDnsAliasCreateOrUpdateContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CreateDnsRecord)) + { + writer.WritePropertyName("createDnsRecord"); + writer.WriteBooleanValue(CreateDnsRecord.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs new file mode 100644 index 0000000000000..1494a74369894 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasCreateOrUpdateContent.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A managed server dns alias creation request. + public partial class ManagedServerDnsAliasCreateOrUpdateContent + { + /// Initializes a new instance of ManagedServerDnsAliasCreateOrUpdateContent. + public ManagedServerDnsAliasCreateOrUpdateContent() + { + } + + /// Whether or not DNS record should be created for this alias. + public bool? CreateDnsRecord { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasData.Serialization.cs new file mode 100644 index 0000000000000..61475fc1d0188 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasData.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class ManagedServerDnsAliasData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedServerDnsAliasData DeserializeManagedServerDnsAliasData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + Optional azureDnsRecord = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("azureDnsRecord")) + { + azureDnsRecord = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ManagedServerDnsAliasData(id, name, type, systemData, azureDnsRecord.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.Serialization.cs new file mode 100644 index 0000000000000..50262c1084d87 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedServerDnsAliasListResult + { + internal static ManagedServerDnsAliasListResult DeserializeManagedServerDnsAliasListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedServerDnsAliasListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.cs new file mode 100644 index 0000000000000..82e6c13c2fb97 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerDnsAliasListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of managed server DNS aliases. + internal partial class ManagedServerDnsAliasListResult + { + /// Initializes a new instance of ManagedServerDnsAliasListResult. + internal ManagedServerDnsAliasListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedServerDnsAliasListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedServerDnsAliasListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicyData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicyData.Serialization.cs index 94e901115844a..98c379e7d1473 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicyData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicyData.Serialization.cs @@ -56,11 +56,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } - if (Optional.IsDefined(IsManagedIdentityInUse)) - { - writer.WritePropertyName("isManagedIdentityInUse"); - writer.WriteBooleanValue(IsManagedIdentityInUse.Value); - } if (Optional.IsDefined(State)) { writer.WritePropertyName("state"); @@ -97,7 +92,6 @@ internal static ServerBlobAuditingPolicyData DeserializeServerBlobAuditingPolicy Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; - Optional isManagedIdentityInUse = default; Optional state = default; Optional storageEndpoint = default; Optional storageAccountAccessKey = default; @@ -198,16 +192,6 @@ internal static ServerBlobAuditingPolicyData DeserializeServerBlobAuditingPolicy queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("isManagedIdentityInUse")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isManagedIdentityInUse = property0.Value.GetBoolean(); - continue; - } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -242,7 +226,7 @@ internal static ServerBlobAuditingPolicyData DeserializeServerBlobAuditingPolicy continue; } } - return new ServerBlobAuditingPolicyData(id, name, type, systemData, Optional.ToNullable(isDevopsAuditEnabled), Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(isManagedIdentityInUse), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); + return new ServerBlobAuditingPolicyData(id, name, type, systemData, Optional.ToNullable(isDevopsAuditEnabled), Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseBlobAuditingPoliciesRestOperations.cs index 86098f1b5c180..700117e56c2b5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DatabaseBlobAuditingPoliciesRestOperations.cs @@ -33,11 +33,11 @@ public DatabaseBlobAuditingPoliciesRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-11-01-preview"; + _apiVersion = apiVersion ?? "2020-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -52,7 +52,8 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/auditingSettings", false); + uri.AppendPath("/auditingSettings/", false); + uri.AppendPath(blobAuditingPolicyName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -60,73 +61,79 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r return message; } - /// Lists auditing settings of a database. + /// Gets a database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - DatabaseBlobAuditingPolicyListResult value = default; + DatabaseBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseBlobAuditingPolicyListResult.DeserializeDatabaseBlobAuditingPolicyListResult(document.RootElement); + value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((DatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Lists auditing settings of a database. + /// Gets a database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - DatabaseBlobAuditingPolicyListResult value = default; + DatabaseBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseBlobAuditingPolicyListResult.DeserializeDatabaseBlobAuditingPolicyListResult(document.RootElement); + value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((DatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -142,83 +149,89 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets a database's blob auditing policy. + /// Creates or updates a database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. + /// The database blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { DatabaseBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((DatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets a database's blob auditing policy. + /// Creates or updates a database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. + /// The database blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { DatabaseBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((DatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, 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); @@ -229,47 +242,38 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/auditingSettings/", false); - uri.AppendPath(blobAuditingPolicyName.ToString(), true); + uri.AppendPath("/auditingSettings", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates a database's blob auditing policy. + /// Lists auditing settings of a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. - /// The database blob auditing policy. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - DatabaseBlobAuditingPolicyData value = default; + DatabaseBlobAuditingPolicyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); + value = DatabaseBlobAuditingPolicyListResult.DeserializeDatabaseBlobAuditingPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -277,34 +281,30 @@ public async Task> CreateOrUpdateAsync( } } - /// Creates or updates a database's blob auditing policy. + /// Lists auditing settings of a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. - /// The database blob auditing policy. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, DatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - DatabaseBlobAuditingPolicyData value = default; + DatabaseBlobAuditingPolicyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseBlobAuditingPolicyData.DeserializeDatabaseBlobAuditingPolicyData(document.RootElement); + value = DatabaseBlobAuditingPolicyListResult.DeserializeDatabaseBlobAuditingPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs index 2d9b539ed46b1..7129b6b0c5213 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs @@ -33,11 +33,11 @@ public ExtendedDatabaseBlobAuditingPoliciesRestOperations(HttpPipeline pipeline, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-11-01-preview"; + _apiVersion = apiVersion ?? "2020-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -52,7 +52,8 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/extendedAuditingSettings", false); + uri.AppendPath("/extendedAuditingSettings/", false); + uri.AppendPath(blobAuditingPolicyName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -60,73 +61,79 @@ internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string r return message; } - /// Lists extended auditing settings of a database. + /// Gets an extended database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ExtendedDatabaseBlobAuditingPolicyListResult value = default; + ExtendedDatabaseBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExtendedDatabaseBlobAuditingPolicyListResult.DeserializeExtendedDatabaseBlobAuditingPolicyListResult(document.RootElement); + value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ExtendedDatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Lists extended auditing settings of a database. + /// Gets an extended database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ExtendedDatabaseBlobAuditingPolicyListResult value = default; + ExtendedDatabaseBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExtendedDatabaseBlobAuditingPolicyListResult.DeserializeExtendedDatabaseBlobAuditingPolicyListResult(document.RootElement); + value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ExtendedDatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -142,83 +149,89 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets an extended database's blob auditing policy. + /// Creates or updates an extended database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. + /// The extended database blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { ExtendedDatabaseBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ExtendedDatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets an extended database's blob auditing policy. + /// Creates or updates an extended database's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. + /// The extended database blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { ExtendedDatabaseBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ExtendedDatabaseBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, 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); @@ -229,47 +242,38 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/extendedAuditingSettings/", false); - uri.AppendPath(blobAuditingPolicyName.ToString(), true); + uri.AppendPath("/extendedAuditingSettings", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates an extended database's blob auditing policy. + /// Lists extended auditing settings of a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. - /// The extended database blob auditing policy. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - ExtendedDatabaseBlobAuditingPolicyData value = default; + ExtendedDatabaseBlobAuditingPolicyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); + value = ExtendedDatabaseBlobAuditingPolicyListResult.DeserializeExtendedDatabaseBlobAuditingPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -277,34 +281,30 @@ public async Task> CreateOrUpda } } - /// Creates or updates an extended database's blob auditing policy. + /// Lists extended auditing settings of a database. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. 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 blob auditing policy. - /// The extended database blob auditing policy. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedDatabaseBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, blobAuditingPolicyName, data); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - ExtendedDatabaseBlobAuditingPolicyData value = default; + ExtendedDatabaseBlobAuditingPolicyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExtendedDatabaseBlobAuditingPolicyData.DeserializeExtendedDatabaseBlobAuditingPolicyData(document.RootElement); + value = ExtendedDatabaseBlobAuditingPolicyListResult.DeserializeExtendedDatabaseBlobAuditingPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedServerBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedServerBlobAuditingPoliciesRestOperations.cs index 4202214b8efd1..93831a9bf35df 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedServerBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ExtendedServerBlobAuditingPoliciesRestOperations.cs @@ -33,11 +33,11 @@ public ExtendedServerBlobAuditingPoliciesRestOperations(HttpPipeline pipeline, s { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-11-01-preview"; + _apiVersion = apiVersion ?? "2020-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -50,7 +50,8 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/extendedAuditingSettings", false); + uri.AppendPath("/extendedAuditingSettings/", false); + uri.AppendPath(blobAuditingPolicyName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -58,69 +59,75 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res return message; } - /// Lists extended auditing settings of a server. + /// Gets an extended server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the blob auditing policy. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ExtendedServerBlobAuditingPolicyListResult value = default; + ExtendedServerBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExtendedServerBlobAuditingPolicyListResult.DeserializeExtendedServerBlobAuditingPolicyListResult(document.RootElement); + value = ExtendedServerBlobAuditingPolicyData.DeserializeExtendedServerBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ExtendedServerBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Lists extended auditing settings of a server. + /// Gets an extended server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the blob auditing policy. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ExtendedServerBlobAuditingPolicyListResult value = default; + ExtendedServerBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExtendedServerBlobAuditingPolicyListResult.DeserializeExtendedServerBlobAuditingPolicyListResult(document.RootElement); + value = ExtendedServerBlobAuditingPolicyData.DeserializeExtendedServerBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ExtendedServerBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -134,79 +141,75 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets an extended server's blob auditing policy. + /// Creates or updates an extended server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the blob auditing policy. + /// Properties of extended blob auditing policy. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ExtendedServerBlobAuditingPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ExtendedServerBlobAuditingPolicyData.DeserializeExtendedServerBlobAuditingPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ExtendedServerBlobAuditingPolicyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets an extended server's blob auditing policy. + /// Creates or updates an extended server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the blob auditing policy. + /// Properties of extended blob auditing policy. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ExtendedServerBlobAuditingPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ExtendedServerBlobAuditingPolicyData.DeserializeExtendedServerBlobAuditingPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ExtendedServerBlobAuditingPolicyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data) + internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName) { 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); @@ -215,70 +218,67 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/extendedAuditingSettings/", false); - uri.AppendPath(blobAuditingPolicyName.ToString(), true); + uri.AppendPath("/extendedAuditingSettings", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates an extended server's blob auditing policy. + /// Lists extended auditing settings of a server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the blob auditing policy. - /// Properties of extended blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ExtendedServerBlobAuditingPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ExtendedServerBlobAuditingPolicyListResult.DeserializeExtendedServerBlobAuditingPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Creates or updates an extended server's blob auditing policy. + /// Lists extended auditing settings of a server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the blob auditing policy. - /// Properties of extended blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ExtendedServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ExtendedServerBlobAuditingPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ExtendedServerBlobAuditingPolicyListResult.DeserializeExtendedServerBlobAuditingPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs index e8b39a80b3636..22bdb04d38190 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedDatabaseSensitivityLabelsRestOperations.cs @@ -33,10 +33,380 @@ public ManagedDatabaseSensitivityLabelsRestOperations(HttpPipeline pipeline, str { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateListCurrentRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/currentSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (count != null) + { + uri.AppendQuery("$count", count.Value, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListCurrentAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The Boolean to use. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListCurrent(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/currentSensitivityLabels", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(sensitivityLabelUpdateList); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, sensitivityLabelUpdateList); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, sensitivityLabelUpdateList); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (includeDisabledRecommendations != null) + { + uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Specifies whether to include disabled recommendations or not. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(recommendedSensitivityLabelUpdateList); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); + + using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, recommendedSensitivityLabelUpdateList); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); + + using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, recommendedSensitivityLabelUpdateList); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { var message = _pipeline.CreateMessage(); @@ -542,7 +912,7 @@ public Response EnableRecommendation(string subscriptionId, string resourceGroup } } - internal HttpMessage CreateListCurrentRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -557,15 +927,7 @@ internal HttpMessage CreateListCurrentRequest(string subscriptionId, string reso uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/currentSensitivityLabels", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (count != null) - { - uri.AppendQuery("$count", count.Value, true); - } + uri.AppendPath("/sensitivityLabels", false); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -582,20 +944,18 @@ internal HttpMessage CreateListCurrentRequest(string subscriptionId, string reso /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// The String to use. - /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListCurrentAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -616,20 +976,18 @@ public async Task> ListCurrentAsync(string /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// The String to use. - /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListCurrent(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -645,117 +1003,14 @@ public Response ListCurrent(string subscriptionId, s } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList) - { - 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/managedInstances/", false); - uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/currentSensitivityLabels", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sensitivityLabelUpdateList); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update sensitivity labels of a given database using an operations batch. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the managed instance. - /// The name of the database. - /// The SensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, sensitivityLabelUpdateList); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update sensitivity labels of a given database using an operations batch. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the managed instance. - /// The name of the database. - /// The SensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList sensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(sensitivityLabelUpdateList, nameof(sensitivityLabelUpdateList)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, sensitivityLabelUpdateList); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, 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/managedInstances/", false); - uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - if (includeDisabledRecommendations != null) - { - uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -763,24 +1018,26 @@ internal HttpMessage CreateListRecommendedRequest(string subscriptionId, string } /// Gets the sensitivity labels of a given database. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The String to use. - /// Specifies whether to include disabled recommendations or not. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -797,24 +1054,26 @@ public async Task> ListRecommendedAsync(str } /// Gets the sensitivity labels of a given database. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The String to use. - /// Specifies whether to include disabled recommendations or not. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -830,89 +1089,7 @@ public Response ListRecommended(string subscriptionI } } - internal HttpMessage CreateUpdateRecommendedRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList) - { - 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/managedInstances/", false); - uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(recommendedSensitivityLabelUpdateList); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the managed instance. - /// The name of the database. - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateRecommendedAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); - - using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, recommendedSensitivityLabelUpdateList); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update recommended sensitivity labels states of a given database using an operations batch. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the managed instance. - /// The name of the database. - /// The RecommendedSensitivityLabelUpdateList to use. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateRecommended(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList recommendedSensitivityLabelUpdateList, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - Argument.AssertNotNull(recommendedSensitivityLabelUpdateList, nameof(recommendedSensitivityLabelUpdateList)); - - using var message = CreateUpdateRecommendedRequest(subscriptionId, resourceGroupName, managedInstanceName, databaseName, recommendedSensitivityLabelUpdateList); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) + internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -933,12 +1110,12 @@ internal HttpMessage CreateListCurrentNextPageRequest(string nextLink, string su /// The name of the managed instance. /// The name of the database. /// The String to use. - /// The Boolean to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListCurrentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -946,7 +1123,7 @@ public async Task> ListCurrentNextPageAsync Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -969,12 +1146,12 @@ public async Task> ListCurrentNextPageAsync /// The name of the managed instance. /// The name of the database. /// The String to use. - /// The Boolean to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListCurrentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -982,7 +1159,7 @@ public Response ListCurrentNextPage(string nextLink, Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListCurrentNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); + using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -998,7 +1175,7 @@ public Response ListCurrentNextPage(string nextLink, } } - internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1018,13 +1195,11 @@ internal HttpMessage CreateListRecommendedNextPageRequest(string nextLink, strin /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// The String to use. - /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListRecommendedNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1032,7 +1207,7 @@ public async Task> ListRecommendedNextPageA Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1054,13 +1229,11 @@ public async Task> ListRecommendedNextPageA /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// The String to use. - /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response ListRecommendedNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListByDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1068,7 +1241,7 @@ public Response ListRecommendedNextPage(string nextL Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - using var message = CreateListRecommendedNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName, databaseName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstanceDtcsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstanceDtcsRestOperations.cs new file mode 100644 index 0000000000000..166754ee39bb2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstanceDtcsRestOperations.cs @@ -0,0 +1,361 @@ +// 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 ManagedInstanceDtcsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedInstanceDtcsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedInstanceDtcsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-02-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByManagedInstanceRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dtc", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceDtcListResult.DeserializeManagedInstanceDtcListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceDtcListResult.DeserializeManagedInstanceDtcListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dtc/", false); + uri.AppendPath(dtcName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed instance DTC. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dtcName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceDtcData.DeserializeManagedInstanceDtcData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedInstanceDtcData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed instance DTC. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dtcName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceDtcData.DeserializeManagedInstanceDtcData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedInstanceDtcData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName, ManagedInstanceDtcData data) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dtc/", false); + uri.AppendPath(dtcName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed instance DTC. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dtcName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates managed instance DTC settings. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed instance DTC. + /// Managed instance DTC settings. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName, ManagedInstanceDtcData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dtcName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed instance DTC settings. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceDtcListResult.DeserializeManagedInstanceDtcListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed instance DTC settings. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceDtcListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceDtcListResult.DeserializeManagedInstanceDtcListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs new file mode 100644 index 0000000000000..6fdf5d720d848 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedServerDnsAliasesRestOperations.cs @@ -0,0 +1,531 @@ +// 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 ManagedServerDnsAliasesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedServerDnsAliasesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedServerDnsAliasesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2021-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByManagedInstanceRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dnsAliases", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstance(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a server DNS alias. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedServerDnsAliasData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a server DNS alias. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasData.DeserializeManagedServerDnsAliasData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedServerDnsAliasData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content) + { + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Creates a managed server DNS alias. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a managed server DNS alias. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasCreateOrUpdateContent to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes the managed server DNS alias with the given name. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the managed server DNS alias with the given name. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateAcquireRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition managedServerDnsAliasAcquisition) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + 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/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/dnsAliases/", false); + uri.AppendPath(dnsAliasName, true); + uri.AppendPath("/acquire", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(managedServerDnsAliasAcquisition); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Acquires managed server DNS alias from another managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task AcquireAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition managedServerDnsAliasAcquisition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(managedServerDnsAliasAcquisition, nameof(managedServerDnsAliasAcquisition)); + + using var message = CreateAcquireRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, managedServerDnsAliasAcquisition); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Acquires managed server DNS alias from another managed server. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedServerDnsAliasAcquisition to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Acquire(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition managedServerDnsAliasAcquisition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(dnsAliasName, nameof(dnsAliasName)); + Argument.AssertNotNull(managedServerDnsAliasAcquisition, nameof(managedServerDnsAliasAcquisition)); + + using var message = CreateAcquireRequest(subscriptionId, resourceGroupName, managedInstanceName, dnsAliasName, managedServerDnsAliasAcquisition); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of managed server DNS aliases for a managed server. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByManagedInstanceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedServerDnsAliasListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedServerDnsAliasListResult.DeserializeManagedServerDnsAliasListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs index 77beab74f71f1..66ceac27c15e8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/SensitivityLabelsRestOperations.cs @@ -33,7 +33,7 @@ public SensitivityLabelsRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2021-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -407,11 +407,11 @@ public Response UpdateRecommended(string subscriptionId, string resourceGroupNam } } - internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { 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); @@ -429,15 +429,15 @@ internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, st uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("recommended", true); - uri.AppendPath("/enable", false); + uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + /// Gets the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -445,10 +445,11 @@ internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, st /// The name of the schema. /// The name of the table. /// The name of the column. + /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task EnableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -458,18 +459,25 @@ public async Task EnableRecommendationAsync(string subscriptionId, str Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + SensitivityLabelData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SensitivityLabelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + /// Gets the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -477,10 +485,11 @@ public async Task EnableRecommendationAsync(string subscriptionId, str /// The name of the schema. /// The name of the table. /// The name of the column. + /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response EnableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -490,22 +499,29 @@ public Response EnableRecommendation(string subscriptionId, string resourceGroup Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + SensitivityLabelData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SensitivityLabelData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -523,15 +539,19 @@ internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, s uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("recommended", true); - uri.AppendPath("/disable", false); + uri.AppendPath("current", true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Disables sensitivity recommendations on a given column. + /// Creates or updates the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -539,10 +559,11 @@ internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, s /// The name of the schema. /// The name of the table. /// The name of the column. + /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , or is null. + /// , , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task DisableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -551,19 +572,26 @@ public async Task DisableRecommendationAsync(string subscriptionId, st Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + SensitivityLabelData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Disables sensitivity recommendations on a given column. + /// Creates or updates the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -571,10 +599,11 @@ public async Task DisableRecommendationAsync(string subscriptionId, st /// The name of the schema. /// The name of the table. /// The name of the column. + /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , or is null. + /// , , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response DisableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -583,23 +612,30 @@ public Response DisableRecommendation(string subscriptionId, string resourceGrou Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + SensitivityLabelData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -617,15 +653,14 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); + uri.AppendPath("current", true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets the sensitivity label of a given column. + /// Deletes the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -633,11 +668,10 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The name of the schema. /// The name of the table. /// The name of the column. - /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -647,25 +681,18 @@ public async Task> GetAsync(string subscriptionId Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - SensitivityLabelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SensitivityLabelData)null, message.Response); + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the sensitivity label of a given column. + /// Deletes the sensitivity label of a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -673,11 +700,10 @@ public async Task> GetAsync(string subscriptionId /// The name of the schema. /// The name of the table. /// The name of the column. - /// The source of the sensitivity label. /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -687,29 +713,22 @@ public Response Get(string subscriptionId, string resource Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - SensitivityLabelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SensitivityLabelData)null, message.Response); + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data) + internal HttpMessage CreateDisableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -727,19 +746,15 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("current", true); + uri.AppendPath("recommended", true); + uri.AppendPath("/disable", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates the sensitivity label of a given column. + /// Disables sensitivity recommendations on a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -747,11 +762,10 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The name of the schema. /// The name of the table. /// The name of the column. - /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , , or is null. + /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) + public async Task DisableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -760,26 +774,19 @@ public async Task> CreateOrUpdateAsync(string sub Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); + using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - { - SensitivityLabelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Creates or updates the sensitivity label of a given column. + /// Disables sensitivity recommendations on a given column. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -787,11 +794,10 @@ public async Task> CreateOrUpdateAsync(string sub /// The name of the schema. /// The name of the table. /// The name of the column. - /// The column sensitivity label resource. /// The cancellation token to use. - /// , , , , , , or is null. + /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelData data, CancellationToken cancellationToken = default) + public Response DisableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -800,30 +806,23 @@ public Response CreateOrUpdate(string subscriptionId, stri Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, data); + using var message = CreateDisableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - { - SensitivityLabelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SensitivityLabelData.DeserializeSensitivityLabelData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + internal HttpMessage CreateEnableRecommendationRequest(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -841,14 +840,15 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/columns/", false); uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); - uri.AppendPath("current", true); + uri.AppendPath("recommended", true); + uri.AppendPath("/enable", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; _userAgent.Apply(message); return message; } - /// Deletes the sensitivity label of a given column. + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -859,7 +859,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public async Task EnableRecommendationAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -869,7 +869,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -880,7 +880,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes the sensitivity label of a given column. + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -891,7 +891,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The cancellation token to use. /// , , , , , or is null. /// , , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + public Response EnableRecommendation(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -901,7 +901,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s Argument.AssertNotNullOrEmpty(tableName, nameof(tableName)); Argument.AssertNotNullOrEmpty(columnName, nameof(columnName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + using var message = CreateEnableRecommendationRequest(subscriptionId, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -912,6 +912,97 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s } } + internal HttpMessage CreateListByDatabaseRequest(string subscriptionId, 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("/sensitivityLabels", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. 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. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseAsync(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. 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. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDatabase(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseRequest(subscriptionId, resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); @@ -1083,5 +1174,87 @@ public Response ListRecommendedByDatabaseNextPage(st throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string subscriptionId, 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"); + _userAgent.Apply(message); + return message; + } + + /// Gets the sensitivity labels of a given database. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. 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. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the sensitivity labels of a given database. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. 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. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDatabaseNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); + + using var message = CreateListByDatabaseNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SensitivityLabelListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SensitivityLabelListResult.DeserializeSensitivityLabelListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerBlobAuditingPoliciesRestOperations.cs index 46c90267df534..50400c2b04db7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ServerBlobAuditingPoliciesRestOperations.cs @@ -33,11 +33,11 @@ public ServerBlobAuditingPoliciesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-11-01-preview"; + _apiVersion = apiVersion ?? "2020-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -50,7 +50,8 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/auditingSettings", false); + uri.AppendPath("/auditingSettings/", false); + uri.AppendPath(blobAuditingPolicyName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -58,69 +59,75 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res return message; } - /// Lists auditing settings of a server. + /// Gets a server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the blob auditing policy. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ServerBlobAuditingPolicyListResult value = default; + ServerBlobAuditingPolicyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServerBlobAuditingPolicyListResult.DeserializeServerBlobAuditingPolicyListResult(document.RootElement); + value = ServerBlobAuditingPolicyData.DeserializeServerBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ServerBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Lists auditing settings of a server. + /// Gets a server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the blob auditing policy. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ServerBlobAuditingPolicyListResult value = default; + ServerBlobAuditingPolicyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServerBlobAuditingPolicyListResult.DeserializeServerBlobAuditingPolicyListResult(document.RootElement); + value = ServerBlobAuditingPolicyData.DeserializeServerBlobAuditingPolicyData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ServerBlobAuditingPolicyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -134,79 +141,75 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets a server's blob auditing policy. + /// Creates or updates a server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the blob auditing policy. + /// Properties of blob auditing policy. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ServerBlobAuditingPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServerBlobAuditingPolicyData.DeserializeServerBlobAuditingPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ServerBlobAuditingPolicyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a server's blob auditing policy. + /// Creates or updates a server's blob auditing policy. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the blob auditing policy. + /// Properties of blob auditing policy. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ServerBlobAuditingPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServerBlobAuditingPolicyData.DeserializeServerBlobAuditingPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ServerBlobAuditingPolicyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data) + internal HttpMessage CreateListByServerRequest(string subscriptionId, string resourceGroupName, string serverName) { 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); @@ -215,70 +218,67 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/auditingSettings/", false); - uri.AppendPath(blobAuditingPolicyName.ToString(), true); + uri.AppendPath("/auditingSettings", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates a server's blob auditing policy. + /// Lists auditing settings of a server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the blob auditing policy. - /// Properties of blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public async Task> ListByServerAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ServerBlobAuditingPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerBlobAuditingPolicyListResult.DeserializeServerBlobAuditingPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Creates or updates a server's blob auditing policy. + /// Lists auditing settings of a server. /// The subscription ID that identifies an Azure subscription. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the blob auditing policy. - /// Properties of blob auditing policy. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName, ServerBlobAuditingPolicyData data, CancellationToken cancellationToken = default) + public Response ListByServer(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, blobAuditingPolicyName, data); + using var message = CreateListByServerRequest(subscriptionId, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ServerBlobAuditingPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerBlobAuditingPolicyListResult.DeserializeServerBlobAuditingPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPolicyData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPolicyData.cs index 332d9c96485b3..ab39198370359 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPolicyData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPolicyData.cs @@ -74,10 +74,6 @@ public ServerBlobAuditingPolicyData() /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -123,7 +119,6 @@ public ServerBlobAuditingPolicyData() /// Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - /// Specifies whether Managed Identity is used to access blob storage. /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. /// @@ -135,7 +130,7 @@ public ServerBlobAuditingPolicyData() /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) /// /// Specifies the blob storage subscription Id. - internal ServerBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isDevopsAuditEnabled, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, bool? isManagedIdentityInUse, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) + internal ServerBlobAuditingPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isDevopsAuditEnabled, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, resourceType, systemData) { IsDevopsAuditEnabled = isDevopsAuditEnabled; RetentionDays = retentionDays; @@ -143,7 +138,6 @@ internal ServerBlobAuditingPolicyData(ResourceIdentifier id, string name, Resour IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; - IsManagedIdentityInUse = isManagedIdentityInUse; State = state; StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; @@ -199,10 +193,6 @@ internal ServerBlobAuditingPolicyData(ResourceIdentifier id, string name, Resour /// USER_CHANGE_PASSWORD_GROUP /// BATCH_STARTED_GROUP /// BATCH_COMPLETED_GROUP - /// DBCC_GROUP - /// DATABASE_OWNERSHIP_CHANGE_GROUP - /// DATABASE_CHANGE_GROUP - /// LEDGER_OPERATION_GROUP /// /// These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. /// @@ -252,8 +242,6 @@ internal ServerBlobAuditingPolicyData(ResourceIdentifier id, string name, Resour /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } - /// Specifies whether Managed Identity is used to access blob storage. - public bool? IsManagedIdentityInUse { get; set; } /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. public BlobAuditingPolicyState? State { get; set; } /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs index 604cb62e51cb7..72bc19052c385 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseSchemaTableColumnResource.cs @@ -174,18 +174,18 @@ public virtual Response Get(Cancellatio } /// - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable - /// Operation Id: SensitivityLabels_EnableRecommendation + /// Disables sensitivity recommendations on a given column + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable + /// Operation Id: SensitivityLabels_DisableRecommendation /// /// The cancellation token to use. - public virtual async Task EnableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) + public virtual async Task DisableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -196,18 +196,18 @@ public virtual async Task EnableRecommendationSensitivityLabelAsync(Ca } /// - /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable - /// Operation Id: SensitivityLabels_EnableRecommendation + /// Disables sensitivity recommendations on a given column + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable + /// Operation Id: SensitivityLabels_DisableRecommendation /// /// The cancellation token to use. - public virtual Response EnableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) + public virtual Response DisableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -218,18 +218,18 @@ public virtual Response EnableRecommendationSensitivityLabel(CancellationToken c } /// - /// Disables sensitivity recommendations on a given column - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable - /// Operation Id: SensitivityLabels_DisableRecommendation + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable + /// Operation Id: SensitivityLabels_EnableRecommendation /// /// The cancellation token to use. - public virtual async Task DisableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) + public virtual async Task EnableRecommendationSensitivityLabelAsync(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); scope.Start(); try { - var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -240,18 +240,18 @@ public virtual async Task DisableRecommendationSensitivityLabelAsync(C } /// - /// Disables sensitivity recommendations on a given column - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable - /// Operation Id: SensitivityLabels_DisableRecommendation + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns) + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable + /// Operation Id: SensitivityLabels_EnableRecommendation /// /// The cancellation token to use. - public virtual Response DisableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) + public virtual Response EnableRecommendationSensitivityLabel(CancellationToken cancellationToken = default) { - using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.DisableRecommendationSensitivityLabel"); + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("ServerDatabaseSchemaTableColumnResource.EnableRecommendationSensitivityLabel"); scope.Start(); try { - var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.DisableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.EnableRecommendation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index 489711ec9a623..111be242111fc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -164,6 +164,72 @@ public virtual Response GetGeoBackupPolicy(GeoBackupPol return GetGeoBackupPolicies().Get(geoBackupPolicyName, cancellationToken); } + /// Gets a collection of ExtendedDatabaseBlobAuditingPolicyResources in the SqlDatabase. + /// An object representing collection of ExtendedDatabaseBlobAuditingPolicyResources and their operations over a ExtendedDatabaseBlobAuditingPolicyResource. + public virtual ExtendedDatabaseBlobAuditingPolicyCollection GetExtendedDatabaseBlobAuditingPolicies() + { + return GetCachedClient(Client => new ExtendedDatabaseBlobAuditingPolicyCollection(Client, Id)); + } + + /// + /// Gets an extended database's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// Operation Id: ExtendedDatabaseBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetExtendedDatabaseBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return await GetExtendedDatabaseBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an extended database's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// Operation Id: ExtendedDatabaseBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return GetExtendedDatabaseBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); + } + + /// Gets a collection of DatabaseBlobAuditingPolicyResources in the SqlDatabase. + /// An object representing collection of DatabaseBlobAuditingPolicyResources and their operations over a DatabaseBlobAuditingPolicyResource. + public virtual DatabaseBlobAuditingPolicyCollection GetDatabaseBlobAuditingPolicies() + { + return GetCachedClient(Client => new DatabaseBlobAuditingPolicyCollection(Client, Id)); + } + + /// + /// Gets a database's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} + /// Operation Id: DatabaseBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return await GetDatabaseBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a database's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} + /// Operation Id: DatabaseBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetDatabaseBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return GetDatabaseBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); + } + /// Gets a collection of ServerDatabaseAdvisorResources in the SqlDatabase. /// An object representing collection of ServerDatabaseAdvisorResources and their operations over a ServerDatabaseAdvisorResource. public virtual ServerDatabaseAdvisorCollection GetServerDatabaseAdvisors() @@ -638,72 +704,6 @@ public virtual Response GetReplicationLink(string linkI return GetReplicationLinks().Get(linkId, cancellationToken); } - /// Gets a collection of DatabaseBlobAuditingPolicyResources in the SqlDatabase. - /// An object representing collection of DatabaseBlobAuditingPolicyResources and their operations over a DatabaseBlobAuditingPolicyResource. - public virtual DatabaseBlobAuditingPolicyCollection GetDatabaseBlobAuditingPolicies() - { - return GetCachedClient(Client => new DatabaseBlobAuditingPolicyCollection(Client, Id)); - } - - /// - /// Gets a database's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} - /// Operation Id: DatabaseBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetDatabaseBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return await GetDatabaseBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a database's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName} - /// Operation Id: DatabaseBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetDatabaseBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return GetDatabaseBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); - } - - /// Gets a collection of ExtendedDatabaseBlobAuditingPolicyResources in the SqlDatabase. - /// An object representing collection of ExtendedDatabaseBlobAuditingPolicyResources and their operations over a ExtendedDatabaseBlobAuditingPolicyResource. - public virtual ExtendedDatabaseBlobAuditingPolicyCollection GetExtendedDatabaseBlobAuditingPolicies() - { - return GetCachedClient(Client => new ExtendedDatabaseBlobAuditingPolicyCollection(Client, Id)); - } - - /// - /// Gets an extended database's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} - /// Operation Id: ExtendedDatabaseBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetExtendedDatabaseBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return await GetExtendedDatabaseBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets an extended database's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName} - /// Operation Id: ExtendedDatabaseBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return GetExtendedDatabaseBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); - } - /// /// Gets a database. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} @@ -2164,6 +2164,92 @@ public virtual Response UpdateRecommendedSensitivityLabel(RecommendedSensitivity } } + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: SensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSensitivityLabelsAsync(string filter = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); + scope.Start(); + try + { + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); + scope.Start(); + try + { + var response = await _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Gets the sensitivity labels of a given database + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels + /// Operation Id: SensitivityLabels_ListByDatabase + /// + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSensitivityLabels(string filter = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); + scope.Start(); + try + { + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsClientDiagnostics.CreateScope("SqlDatabaseResource.GetSensitivityLabels"); + scope.Start(); + try + { + var response = _serverDatabaseSchemaTableColumnSensitivityLabelSensitivityLabelsRestClient.ListByDatabaseNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ServerDatabaseSchemaTableColumnSensitivityLabelResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + /// /// Add a tag to the current resource. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 1e77201d8f9fb..23ee678527cea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -228,6 +228,72 @@ public virtual Response GetServiceObjective(string ser return GetServiceObjectives().Get(serviceObjectiveName, cancellationToken); } + /// Gets a collection of ExtendedServerBlobAuditingPolicyResources in the SqlServer. + /// An object representing collection of ExtendedServerBlobAuditingPolicyResources and their operations over a ExtendedServerBlobAuditingPolicyResource. + public virtual ExtendedServerBlobAuditingPolicyCollection GetExtendedServerBlobAuditingPolicies() + { + return GetCachedClient(Client => new ExtendedServerBlobAuditingPolicyCollection(Client, Id)); + } + + /// + /// Gets an extended server's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// Operation Id: ExtendedServerBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetExtendedServerBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return await GetExtendedServerBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an extended server's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} + /// Operation Id: ExtendedServerBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetExtendedServerBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return GetExtendedServerBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); + } + + /// Gets a collection of ServerBlobAuditingPolicyResources in the SqlServer. + /// An object representing collection of ServerBlobAuditingPolicyResources and their operations over a ServerBlobAuditingPolicyResource. + public virtual ServerBlobAuditingPolicyCollection GetServerBlobAuditingPolicies() + { + return GetCachedClient(Client => new ServerBlobAuditingPolicyCollection(Client, Id)); + } + + /// + /// Gets a server's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} + /// Operation Id: ServerBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServerBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return await GetServerBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server's blob auditing policy. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} + /// Operation Id: ServerBlobAuditingPolicies_Get + /// + /// The name of the blob auditing policy. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServerBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) + { + return GetServerBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); + } + /// Gets a collection of ServerAdvisorResources in the SqlServer. /// An object representing collection of ServerAdvisorResources and their operations over a ServerAdvisorResource. public virtual ServerAdvisorCollection GetServerAdvisors() @@ -1025,72 +1091,6 @@ public virtual Response GetIPv6FirewallRule(string fir return GetIPv6FirewallRules().Get(firewallRuleName, cancellationToken); } - /// Gets a collection of ServerBlobAuditingPolicyResources in the SqlServer. - /// An object representing collection of ServerBlobAuditingPolicyResources and their operations over a ServerBlobAuditingPolicyResource. - public virtual ServerBlobAuditingPolicyCollection GetServerBlobAuditingPolicies() - { - return GetCachedClient(Client => new ServerBlobAuditingPolicyCollection(Client, Id)); - } - - /// - /// Gets a server's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} - /// Operation Id: ServerBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetServerBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return await GetServerBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a server's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName} - /// Operation Id: ServerBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetServerBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return GetServerBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); - } - - /// Gets a collection of ExtendedServerBlobAuditingPolicyResources in the SqlServer. - /// An object representing collection of ExtendedServerBlobAuditingPolicyResources and their operations over a ExtendedServerBlobAuditingPolicyResource. - public virtual ExtendedServerBlobAuditingPolicyCollection GetExtendedServerBlobAuditingPolicies() - { - return GetCachedClient(Client => new ExtendedServerBlobAuditingPolicyCollection(Client, Id)); - } - - /// - /// Gets an extended server's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} - /// Operation Id: ExtendedServerBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetExtendedServerBlobAuditingPolicyAsync(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return await GetExtendedServerBlobAuditingPolicies().GetAsync(blobAuditingPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets an extended server's blob auditing policy. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName} - /// Operation Id: ExtendedServerBlobAuditingPolicies_Get - /// - /// The name of the blob auditing policy. - /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetExtendedServerBlobAuditingPolicy(BlobAuditingPolicyName blobAuditingPolicyName, CancellationToken cancellationToken = default) - { - return GetExtendedServerBlobAuditingPolicies().Get(blobAuditingPolicyName, cancellationToken); - } - /// /// Gets a server. /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index 7945d36437968..9f75afe8a8b7e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/55090ea4342b5dac48bc2e9706e3a59465ffa34c/specification/sql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/d773bb7f43d0add692979e52ba09e74075c75b6b/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated model-namespace: false