diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs index c765f5ab8764..86f658fbf339 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs @@ -102,7 +102,7 @@ internal DatabaseSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; + string securityAlertPolicyName = "Default"; string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -320,7 +320,7 @@ internal DatabaseSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; + string securityAlertPolicyName = "Default"; string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs index b21c6d120aaa..d0a8ca5969cd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -127,16 +127,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; } - /// - /// Gets the ITransparentDataEncryptionsOperations. - /// - ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; } - - /// - /// Gets the ITransparentDataEncryptionActivitiesOperations. - /// - ITransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities { get; } - /// /// Gets the IServerUsagesOperations. /// @@ -617,6 +607,11 @@ public partial interface ISqlManagementClient : System.IDisposable /// IWorkloadGroupsOperations WorkloadGroups { get; } + /// + /// Gets the ITransparentDataEncryptionsOperations. + /// + ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; } + /// /// Gets the IBackupShortTermRetentionPoliciesOperations. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs deleted file mode 100644 index c56b71073b48..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionActivitiesOperations.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// TransparentDataEncryptionActivitiesOperations operations. - /// - public partial interface ITransparentDataEncryptionActivitiesOperations - { - /// - /// Returns a database's transparent data encryption operation result. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database for which the transparent data encryption - /// applies. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs index 818b21be23d3..e79200fd413f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITransparentDataEncryptionsOperations.cs @@ -24,7 +24,38 @@ namespace Microsoft.Azure.Management.Sql public partial interface ITransparentDataEncryptionsOperations { /// - /// Creates or updates a database's transparent data encryption + /// Gets a logical database's transparent data encryption. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the logical database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a logical database's transparent data encryption /// configuration. /// /// @@ -36,12 +67,11 @@ public partial interface ITransparentDataEncryptionsOperations /// The name of the server. /// /// - /// The name of the database for which setting the transparent data - /// encryption applies. + /// The name of the logical database for which the security alert + /// policy is defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// /// /// The headers that will be added to request. @@ -58,9 +88,9 @@ public partial interface ITransparentDataEncryptionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can @@ -71,8 +101,30 @@ public partial interface ITransparentDataEncryptionsOperations /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption - /// applies. + /// The name of the logical database for which the transparent data + /// encryption is defined. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -89,6 +141,6 @@ public partial interface ITransparentDataEncryptionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs index 6d3c3007cdaf..3958beedec7f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs @@ -103,7 +103,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; + string securityAlertPolicyName = "Default"; string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -322,7 +322,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; + string securityAlertPolicyName = "Default"; string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs index f9e10892ef90..fc1214b24fa8 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryption.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs @@ -16,33 +16,33 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents a database transparent data encryption configuration. + /// A logical database transparent data encryption state. /// [Rest.Serialization.JsonTransformation] - public partial class TransparentDataEncryption : ProxyResource + public partial class LogicalDatabaseTransparentDataEncryption : ProxyResource { /// - /// Initializes a new instance of the TransparentDataEncryption class. + /// Initializes a new instance of the + /// LogicalDatabaseTransparentDataEncryption class. /// - public TransparentDataEncryption() + public LogicalDatabaseTransparentDataEncryption() { CustomInit(); } /// - /// Initializes a new instance of the TransparentDataEncryption class. + /// Initializes a new instance of the + /// LogicalDatabaseTransparentDataEncryption class. /// + /// Specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// Resource location. - /// The status of the database transparent data - /// encryption. Possible values include: 'Enabled', 'Disabled' - public TransparentDataEncryption(string id = default(string), string name = default(string), string type = default(string), string location = default(string), TransparentDataEncryptionStatus? status = default(TransparentDataEncryptionStatus?)) + public LogicalDatabaseTransparentDataEncryption(TransparentDataEncryptionState state, string id = default(string), string name = default(string), string type = default(string)) : base(id, name, type) { - Location = location; - Status = status; + State = state; CustomInit(); } @@ -52,17 +52,20 @@ public TransparentDataEncryption() partial void CustomInit(); /// - /// Gets resource location. + /// Gets or sets specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } + [JsonProperty(PropertyName = "properties.state")] + public TransparentDataEncryptionState State { get; set; } /// - /// Gets or sets the status of the database transparent data - /// encryption. Possible values include: 'Enabled', 'Disabled' + /// Validate the object. /// - [JsonProperty(PropertyName = "properties.status")] - public TransparentDataEncryptionStatus? Status { get; set; } - + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs deleted file mode 100644 index ab34253c2b81..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a database transparent data encryption Scan. - /// - [Rest.Serialization.JsonTransformation] - public partial class TransparentDataEncryptionActivity : ProxyResource - { - /// - /// Initializes a new instance of the TransparentDataEncryptionActivity - /// class. - /// - public TransparentDataEncryptionActivity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TransparentDataEncryptionActivity - /// class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource location. - /// The status of the database. Possible values - /// include: 'Encrypting', 'Decrypting' - /// The percent complete of the - /// transparent data encryption scan for a database. - public TransparentDataEncryptionActivity(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string status = default(string), double? percentComplete = default(double?)) - : base(id, name, type) - { - Location = location; - Status = status; - PercentComplete = percentComplete; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the status of the database. Possible values include: - /// 'Encrypting', 'Decrypting' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } - - /// - /// Gets the percent complete of the transparent data encryption scan - /// for a database. - /// - [JsonProperty(PropertyName = "properties.percentComplete")] - public double? PercentComplete { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs deleted file mode 100644 index 5880bd69d615..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for TransparentDataEncryptionActivityStatus. - /// - public static class TransparentDataEncryptionActivityStatus - { - public const string Encrypting = "Encrypting"; - public const string Decrypting = "Decrypting"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs deleted file mode 100644 index 63f5456de378..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for TransparentDataEncryptionStatus. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum TransparentDataEncryptionStatus - { - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled - } - internal static class TransparentDataEncryptionStatusEnumExtension - { - internal static string ToSerializedValue(this TransparentDataEncryptionStatus? value) - { - return value == null ? null : ((TransparentDataEncryptionStatus)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this TransparentDataEncryptionStatus value) - { - switch( value ) - { - case TransparentDataEncryptionStatus.Enabled: - return "Enabled"; - case TransparentDataEncryptionStatus.Disabled: - return "Disabled"; - } - return null; - } - - internal static TransparentDataEncryptionStatus? ParseTransparentDataEncryptionStatus(this string value) - { - switch( value ) - { - case "Enabled": - return TransparentDataEncryptionStatus.Enabled; - case "Disabled": - return TransparentDataEncryptionStatus.Disabled; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs index d59a0d04b403..07f34868397f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs @@ -135,8 +135,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "SyncMembers", "2020-11-01-preview"), new Tuple("Sql", "TdeCertificates", "2020-11-01-preview"), new Tuple("Sql", "TimeZones", "2020-11-01-preview"), - new Tuple("Sql", "TransparentDataEncryptionActivities", "2014-04-01"), - new Tuple("Sql", "TransparentDataEncryptions", "2014-04-01"), + new Tuple("Sql", "TransparentDataEncryptions", "2021-02-01-preview"), new Tuple("Sql", "Usages", "2021-02-01-preview"), new Tuple("Sql", "VirtualClusters", "2020-11-01-preview"), new Tuple("Sql", "VirtualNetworkRules", "2020-11-01-preview"), @@ -145,16 +144,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/sql/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "111fbceeeb7c2c4905b80fe2ab760e5564b3458a"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs index acf04682292d..a7f264e84dd9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -132,16 +132,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; private set; } - /// - /// Gets the ITransparentDataEncryptionsOperations. - /// - public virtual ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; private set; } - - /// - /// Gets the ITransparentDataEncryptionActivitiesOperations. - /// - public virtual ITransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities { get; private set; } - /// /// Gets the IServerUsagesOperations. /// @@ -622,6 +612,11 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } + /// + /// Gets the ITransparentDataEncryptionsOperations. + /// + public virtual ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; private set; } + /// /// Gets the IBackupShortTermRetentionPoliciesOperations. /// @@ -925,8 +920,6 @@ private void Initialize() ServiceObjectives = new ServiceObjectivesOperations(this); ElasticPoolActivities = new ElasticPoolActivitiesOperations(this); ElasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesOperations(this); - TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); - TransparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesOperations(this); ServerUsages = new ServerUsagesOperations(this); ExtendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesOperations(this); ExtendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesOperations(this); @@ -1023,6 +1016,7 @@ private void Initialize() VirtualNetworkRules = new VirtualNetworkRulesOperations(this); WorkloadClassifiers = new WorkloadClassifiersOperations(this); WorkloadGroups = new WorkloadGroupsOperations(this); + TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); DatabaseExtensions = new DatabaseExtensionsOperations(this); DatabaseOperations = new DatabaseOperations(this); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs deleted file mode 100644 index f6ea310015fe..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs +++ /dev/null @@ -1,261 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// TransparentDataEncryptionActivitiesOperations operations. - /// - internal partial class TransparentDataEncryptionActivitiesOperations : IServiceOperations, ITransparentDataEncryptionActivitiesOperations - { - /// - /// Initializes a new instance of the TransparentDataEncryptionActivitiesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal TransparentDataEncryptionActivitiesOperations(SqlManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SqlManagementClient - /// - public SqlManagementClient Client { get; private set; } - - /// - /// Returns a database's transparent data encryption operation result. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database for which the transparent data encryption applies. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByConfiguration", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs deleted file mode 100644 index 6211972ac38c..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionActivitiesOperationsExtensions.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for TransparentDataEncryptionActivitiesOperations. - /// - public static partial class TransparentDataEncryptionActivitiesOperationsExtensions - { - /// - /// Returns a database's transparent data encryption operation result. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database for which the transparent data encryption applies. - /// - public static IEnumerable ListByConfiguration(this ITransparentDataEncryptionActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.ListByConfigurationAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Returns a database's transparent data encryption operation result. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database for which the transparent data encryption applies. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByConfigurationAsync(this ITransparentDataEncryptionActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByConfigurationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs index 5b30e4f81873..ee461cf9724f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperations.cs @@ -51,7 +51,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,12 +61,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. - /// - /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// Headers that will be added to request. @@ -89,12 +85,219 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string tdeName = "current"; + string apiVersion = "2021-02-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a logical database's transparent data encryption configuration. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the logical database for which the security alert policy is + /// defined. + /// + /// + /// The database transparent data encryption. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -111,8 +314,16 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string tdeName = "current"; + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -120,23 +331,23 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + tracingParameters.Add("tdeName", tdeName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -206,7 +417,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -241,7 +452,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -254,7 +465,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -272,7 +483,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -292,7 +503,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -302,7 +513,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// Headers that will be added to request. @@ -325,12 +537,8 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -343,8 +551,11 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; - string transparentDataEncryptionName = "current"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-02-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -352,22 +563,20 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -466,7 +675,180 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -479,7 +861,7 @@ internal TransparentDataEncryptionsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs index af93ae4da712..d880074daa32 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TransparentDataEncryptionsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class TransparentDataEncryptionsOperationsExtensions { /// - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -35,20 +35,69 @@ public static partial class TransparentDataEncryptionsOperationsExtensions /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. + /// + public static LogicalDatabaseTransparentDataEncryption Get(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a logical database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the logical database for which the transparent data encryption + /// is defined. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a logical database's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the logical database for which the security alert policy is + /// defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// - public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters) + public static LogicalDatabaseTransparentDataEncryption CreateOrUpdate(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters) { return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or updates a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// /// /// The operations group for this extension method. @@ -61,17 +110,16 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr /// The name of the server. /// /// - /// The name of the database for which setting the transparent data encryption - /// applies. + /// The name of the logical database for which the security alert policy is + /// defined. /// /// - /// The required parameters for creating or updating transparent data - /// encryption. + /// The database transparent data encryption. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -80,7 +128,7 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -93,15 +141,16 @@ public static TransparentDataEncryption CreateOrUpdate(this ITransparentDataEncr /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// - public static TransparentDataEncryption Get(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// /// /// The operations group for this extension method. @@ -114,14 +163,49 @@ public static TransparentDataEncryption Get(this ITransparentDataEncryptionsOper /// The name of the server. /// /// - /// The name of the database for which the transparent data encryption applies. + /// The name of the logical database for which the transparent data encryption + /// is defined. /// /// /// The cancellation token. /// - public static async Task GetAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this ITransparentDataEncryptionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ITransparentDataEncryptionsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the logical database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this ITransparentDataEncryptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }