diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs index b083f7fbd36b2..67df5526acafe 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IIPv6FirewallRulesOperations { /// - /// Gets an IPv6 firewall rule. + /// Gets a list of IPv6 firewall rules. /// /// /// The name of the resource group that contains the resource. You can @@ -34,9 +34,6 @@ public partial interface IIPv6FirewallRulesOperations /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The headers that will be added to request. /// @@ -52,9 +49,9 @@ public partial interface IIPv6FirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates an IPv6 firewall rule. + /// Gets an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can @@ -67,10 +64,6 @@ public partial interface IIPv6FirewallRulesOperations /// /// The name of the firewall rule. /// - /// - /// The required parameters for creating or updating an IPv6 firewall - /// rule. - /// /// /// The headers that will be added to request. /// @@ -86,9 +79,9 @@ public partial interface IIPv6FirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes an IPv6 firewall rule. + /// Creates or updates an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can @@ -101,6 +94,10 @@ public partial interface IIPv6FirewallRulesOperations /// /// The name of the firewall rule. /// + /// + /// The required parameters for creating or updating an IPv6 firewall + /// rule. + /// /// /// The headers that will be added to request. /// @@ -110,12 +107,15 @@ public partial interface IIPv6FirewallRulesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of IPv6 firewall rules. + /// Deletes an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can @@ -125,6 +125,9 @@ public partial interface IIPv6FirewallRulesOperations /// /// The name of the server. /// + /// + /// The name of the firewall rule. + /// /// /// The headers that will be added to request. /// @@ -134,13 +137,10 @@ public partial interface IIPv6FirewallRulesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of IPv6 firewall rules. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs index be59cc99b7bc7..e26cac97ec6bf 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedDatabaseSensitivityLabelsOperations { /// - /// Gets the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// /// /// The name of the resource group that contains the resource. You can @@ -38,18 +38,12 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the database. /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. + /// + /// OData parameters to apply to the operation. /// - /// - /// The name of the column. + /// /// - /// - /// The source of the sensitivity label. Possible values include: - /// 'current', 'recommended' + /// /// /// /// The headers that will be added to request. @@ -66,9 +60,10 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the sensitivity label of a given column + /// Update sensitivity labels of a given database using an operations + /// batch. /// /// /// The name of the resource group that contains the resource. You can @@ -81,17 +76,42 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the database. /// - /// - /// The name of the schema. + /// /// - /// - /// The name of the table. + /// + /// The headers that will be added to request. /// - /// - /// The name of the column. + /// + /// The cancellation token. /// - /// - /// The column sensitivity label resource. + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// + /// + /// Specifies whether to include disabled recommendations or not. /// /// /// The headers that will be added to request. @@ -108,9 +128,9 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes the sensitivity label of a given column + /// Gets the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -132,6 +152,10 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the column. /// + /// + /// The source of the sensitivity label. Possible values include: + /// 'current', 'recommended' + /// /// /// The headers that will be added to request. /// @@ -141,12 +165,15 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -168,6 +195,9 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the column. /// + /// + /// The column sensitivity label resource. + /// /// /// The headers that will be added to request. /// @@ -177,13 +207,15 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Enables sensitivity recommendations on a given column - /// (recommendations are enabled by default on all columns) + /// Deletes the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -217,9 +249,9 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the sensitivity labels of a given database + /// Disables sensitivity recommendations on a given column /// /// /// The name of the resource group that contains the resource. You can @@ -232,12 +264,14 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the database. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the schema. /// - /// + /// + /// The name of the table. /// - /// + /// + /// The name of the column. /// /// /// The headers that will be added to request. @@ -248,16 +282,13 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update sensitivity labels of a given database using an operations - /// batch. + /// Enables sensitivity recommendations on a given column + /// (recommendations are enabled by default on all columns) /// /// /// The name of the resource group that contains the resource. You can @@ -270,7 +301,14 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// The name of the database. /// - /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. /// /// /// The headers that will be added to request. @@ -284,7 +322,7 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -302,11 +340,6 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// - /// - /// - /// - /// Specifies whether to include disabled recommendations or not. - /// /// /// The headers that will be added to request. /// @@ -322,7 +355,7 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -367,5 +400,27 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// Thrown when a required parameter is null /// Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedServerDnsAliasesOperations.cs new file mode 100644 index 0000000000000..fc03aa062c0de --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedServerDnsAliasesOperations.cs @@ -0,0 +1,281 @@ +// +// 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; + + /// + /// ManagedServerDnsAliasesOperations operations. + /// + public partial interface IManagedServerDnsAliasesOperations + { + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a managed server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a managed server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs index a11276bd290da..796a2a063278d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs @@ -51,7 +51,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets an IPv6 firewall rule. + /// Gets a list of IPv6 firewall rules. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,9 +60,6 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// Headers that will be added to request. /// @@ -84,7 +81,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -94,15 +91,11 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (firewallRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-08-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -112,17 +105,15 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("firewallRuleName", firewallRuleName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -222,7 +213,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +226,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -255,7 +246,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) } /// - /// Creates or updates an IPv6 firewall rule. + /// Gets an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -267,9 +258,6 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// The name of the firewall rule. /// - /// - /// The required parameters for creating or updating an IPv6 firewall rule. - /// /// /// Headers that will be added to request. /// @@ -291,7 +279,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -305,15 +293,11 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-08-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -324,10 +308,9 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -348,7 +331,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -379,12 +362,6 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -405,7 +382,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -465,24 +442,6 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -491,7 +450,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) } /// - /// Deletes an IPv6 firewall rule. + /// Creates or updates an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -503,6 +462,9 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// The name of the firewall rule. /// + /// + /// The required parameters for creating or updating an IPv6 firewall rule. + /// /// /// Headers that will be added to request. /// @@ -512,6 +474,9 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -521,7 +486,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -535,11 +500,15 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-08-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,9 +519,10 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -573,7 +543,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -604,6 +574,12 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -624,7 +600,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -659,13 +635,49 @@ internal IPv6FirewallRulesOperations(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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -674,7 +686,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) } /// - /// Gets a list of IPv6 firewall rules. + /// Deletes an IPv6 firewall rule. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -683,6 +695,9 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The name of the firewall rule. + /// /// /// Headers that will be added to request. /// @@ -692,9 +707,6 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -704,7 +716,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -714,11 +726,15 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + if (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-08-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -728,15 +744,17 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("firewallRuleName", firewallRuleName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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}/ipv6FirewallRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -750,7 +768,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -801,7 +819,7 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -836,31 +854,13 @@ internal IPv6FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs index e632d77599d74..487adb33c94e4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class IPv6FirewallRulesOperationsExtensions { /// - /// Gets an IPv6 firewall rule. + /// Gets a list of IPv6 firewall rules. /// /// /// The operations group for this extension method. @@ -34,16 +34,13 @@ public static partial class IPv6FirewallRulesOperationsExtensions /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// - public static IPv6FirewallRule Get(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + public static IPage ListByServer(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName) { - return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets an IPv6 firewall rule. + /// Gets a list of IPv6 firewall rules. /// /// /// The operations group for this extension method. @@ -55,22 +52,19 @@ public static IPv6FirewallRule Get(this IIPv6FirewallRulesOperations operations, /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or updates an IPv6 firewall rule. + /// Gets an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -85,16 +79,13 @@ public static IPv6FirewallRule Get(this IIPv6FirewallRulesOperations operations, /// /// The name of the firewall rule. /// - /// - /// The required parameters for creating or updating an IPv6 firewall rule. - /// - public static IPv6FirewallRule CreateOrUpdate(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters) + public static IPv6FirewallRule Get(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); } /// - /// Creates or updates an IPv6 firewall rule. + /// Gets an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -109,22 +100,19 @@ public static IPv6FirewallRule CreateOrUpdate(this IIPv6FirewallRulesOperations /// /// The name of the firewall rule. /// - /// - /// The required parameters for creating or updating an IPv6 firewall rule. - /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes an IPv6 firewall rule. + /// Creates or updates an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -139,13 +127,16 @@ public static IPv6FirewallRule CreateOrUpdate(this IIPv6FirewallRulesOperations /// /// The name of the firewall rule. /// - public static void Delete(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + /// + /// The required parameters for creating or updating an IPv6 firewall rule. + /// + public static IPv6FirewallRule CreateOrUpdate(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters) { - operations.DeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult(); } /// - /// Deletes an IPv6 firewall rule. + /// Creates or updates an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -160,16 +151,22 @@ public static void Delete(this IIPv6FirewallRulesOperations operations, string r /// /// The name of the firewall rule. /// + /// + /// The required parameters for creating or updating an IPv6 firewall rule. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets a list of IPv6 firewall rules. + /// Deletes an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -181,13 +178,16 @@ public static void Delete(this IIPv6FirewallRulesOperations operations, string r /// /// The name of the server. /// - public static IPage ListByServer(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the firewall rule. + /// + public static void Delete(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); } /// - /// Gets a list of IPv6 firewall rules. + /// Deletes an IPv6 firewall rule. /// /// /// The operations group for this extension method. @@ -199,15 +199,15 @@ public static IPage ListByServer(this IIPv6FirewallRulesOperat /// /// The name of the server. /// + /// + /// The name of the firewall rule. + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs index 8e46eb06c69a7..f7b71ae0811b4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs @@ -24,8 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IReplicationLinksOperations { /// - /// Deletes a database replication link. Cannot be done during - /// failover. + /// Gets a list of replication links on database. /// /// /// The name of the resource group that contains the resource. You can @@ -36,11 +35,7 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database that has the replication link to be - /// dropped. - /// - /// - /// The ID of the replication link to be deleted. + /// The name of the database. /// /// /// The headers that will be added to request. @@ -51,10 +46,13 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a replication link. /// @@ -89,8 +87,7 @@ public partial interface IReplicationLinksOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. + /// Deletes the replication link. /// /// /// The name of the resource group that contains the resource. You can @@ -101,11 +98,9 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed - /// over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. /// /// /// The headers that will be added to request. @@ -119,11 +114,9 @@ public partial interface IReplicationLinksOperations /// /// Thrown when a required parameter is null /// - Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. This operation might result in - /// data loss. + /// Fails over from the current primary server to this server. /// /// /// The name of the resource group that contains the resource. You can @@ -134,11 +127,10 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed - /// over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// The headers that will be added to request. @@ -149,46 +141,16 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code + /// + /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// - Task UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of replication links on database. + /// Fails over from the current primary server to this server allowing + /// data loss. /// /// /// The name of the resource group that contains the resource. You can @@ -201,6 +163,9 @@ public partial interface IReplicationLinksOperations /// /// The name of the database. /// + /// + /// The name of the replication link. + /// /// /// The headers that will be added to request. /// @@ -216,7 +181,7 @@ public partial interface IReplicationLinksOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of replication links. /// @@ -245,8 +210,7 @@ public partial interface IReplicationLinksOperations /// Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. + /// Fails over from the current primary server to this server. /// /// /// The name of the resource group that contains the resource. You can @@ -257,11 +221,10 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed - /// over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// The headers that will be added to request. @@ -272,13 +235,15 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Sets which replica database is primary by failing over from the - /// current primary replica database. This operation might result in + /// Fails over from the current primary server to this server allowing /// data loss. /// /// @@ -290,11 +255,10 @@ public partial interface IReplicationLinksOperations /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed - /// over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// The headers that will be added to request. @@ -305,44 +269,13 @@ public partial interface IReplicationLinksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed - /// over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code + /// + /// Thrown when unable to deserialize the response /// /// /// Thrown when a required parameter is null /// - Task BeginUnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of replication links on database. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs index ad73f817a9835..9eabc21a70706 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs @@ -130,8 +130,7 @@ public partial interface ISensitivityLabelsOperations /// Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Enables sensitivity recommendations on a given column - /// (recommendations are enabled by default on all columns) + /// Gets the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -153,6 +152,10 @@ public partial interface ISensitivityLabelsOperations /// /// The name of the column. /// + /// + /// The source of the sensitivity label. Possible values include: + /// 'current', 'recommended' + /// /// /// The headers that will be added to request. /// @@ -162,12 +165,15 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -189,6 +195,9 @@ public partial interface ISensitivityLabelsOperations /// /// The name of the column. /// + /// + /// The column sensitivity label resource. + /// /// /// The headers that will be added to request. /// @@ -198,12 +207,15 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the sensitivity label of a given column + /// Deletes the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can @@ -225,10 +237,6 @@ public partial interface ISensitivityLabelsOperations /// /// The name of the column. /// - /// - /// The source of the sensitivity label. Possible values include: - /// 'current', 'recommended' - /// /// /// The headers that will be added to request. /// @@ -238,15 +246,12 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the sensitivity label of a given column + /// Disables sensitivity recommendations on a given column /// /// /// The name of the resource group that contains the resource. You can @@ -268,9 +273,6 @@ public partial interface ISensitivityLabelsOperations /// /// The name of the column. /// - /// - /// The column sensitivity label resource. - /// /// /// The headers that will be added to request. /// @@ -280,15 +282,13 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes the sensitivity label of a given column + /// Enables sensitivity recommendations on a given column + /// (recommendations are enabled by default on all columns) /// /// /// The name of the resource group that contains the resource. You can @@ -322,7 +322,40 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -367,5 +400,27 @@ public partial interface ISensitivityLabelsOperations /// Thrown when a required parameter is null /// Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs index 3b58b88bad90d..ef2925063bbb3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -97,11 +97,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IElasticPoolsOperations ElasticPools { get; } - /// - /// Gets the IReplicationLinksOperations. - /// - IReplicationLinksOperations ReplicationLinks { get; } - /// /// Gets the IServerCommunicationLinksOperations. /// @@ -342,16 +337,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; } - /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. - /// - IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } - - /// - /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. - /// - IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; } - /// /// Gets the IManagedDatabaseTablesOperations. /// @@ -462,16 +447,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IRestorePointsOperations RestorePoints { get; } - /// - /// Gets the ISensitivityLabelsOperations. - /// - ISensitivityLabelsOperations SensitivityLabels { get; } - - /// - /// Gets the IRecommendedSensitivityLabelsOperations. - /// - IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; } - /// /// Gets the IServerAdvisorsOperations. /// @@ -672,5 +647,35 @@ public partial interface ISqlManagementClient : System.IDisposable /// IIPv6FirewallRulesOperations IPv6FirewallRules { get; } + /// + /// Gets the IReplicationLinksOperations. + /// + IReplicationLinksOperations ReplicationLinks { get; } + + /// + /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// + IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } + + /// + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. + /// + IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; } + + /// + /// Gets the IManagedServerDnsAliasesOperations. + /// + IManagedServerDnsAliasesOperations ManagedServerDnsAliases { get; } + + /// + /// Gets the ISensitivityLabelsOperations. + /// + ISensitivityLabelsOperations SensitivityLabels { get; } + + /// + /// Gets the IRecommendedSensitivityLabelsOperations. + /// + IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs index 83420a3c4ec1c..6f91a482fea0a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -106,7 +106,7 @@ internal ManagedDatabaseRecommendedSensitivityLabelsOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs index 2ad06b5467fb3..d331054369216 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs @@ -52,7 +52,433 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets the sensitivity label of a given column + /// Gets the sensitivity labels of a given database + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("count", count); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (count != null) + { + _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the sensitivity labels of a given database /// /// /// The name of the resource group that contains the resource. You can obtain @@ -64,18 +490,13 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. + /// + /// OData parameters to apply to the operation. /// - /// - /// The name of the column. + /// /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' + /// + /// Specifies whether to include disabled recommendations or not. /// /// /// Headers that will be added to request. @@ -98,7 +519,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -112,23 +533,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (schemaName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (columnName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -136,29 +545,40 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("schemaName", schemaName); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("columnName", columnName); - tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); - _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -256,7 +676,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(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")) @@ -269,7 +689,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -289,7 +709,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Creates or updates the sensitivity label of a given column + /// Gets the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can obtain @@ -310,8 +730,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the column. /// - /// - /// The column sensitivity label resource. + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' /// /// /// Headers that will be added to request. @@ -334,7 +755,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -360,16 +781,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string sensitivityLabelSource = "current"; - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -384,10 +800,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -398,7 +813,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); - _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -412,7 +827,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -443,12 +858,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -469,7 +878,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -529,24 +938,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -555,7 +946,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Deletes the sensitivity label of a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can obtain @@ -576,6 +967,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the column. /// + /// + /// The column sensitivity label resource. + /// /// /// Headers that will be added to request. /// @@ -585,6 +979,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -594,7 +991,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -620,12 +1017,16 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "current"; - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -640,9 +1041,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("tableName", tableName); tracingParameters.Add("columnName", columnName); tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -667,7 +1069,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -698,6 +1100,12 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -718,7 +1126,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -748,17 +1156,53 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _httpRequest.Dispose(); if (_httpResponse != null) { - _httpResponse.Dispose(); + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { @@ -768,7 +1212,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Disables sensitivity recommendations on a given column + /// Deletes the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can obtain @@ -807,7 +1251,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -837,8 +1281,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string sensitivityLabelSource = "recommended"; - string apiVersion = "2020-11-01-preview"; + string sensitivityLabelSource = "current"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -855,11 +1299,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DisableRecommendation", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -880,7 +1324,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -981,8 +1425,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Disables sensitivity recommendations on a given column /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1021,7 +1464,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1052,7 +1495,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1069,11 +1512,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DisableRecommendation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -1195,7 +1638,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Gets the sensitivity labels of a given database + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1207,12 +1651,14 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the schema. /// - /// + /// + /// The name of the table. /// - /// + /// + /// The name of the column. /// /// /// Headers that will be added to request. @@ -1223,9 +1669,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1235,7 +1678,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1249,11 +1692,24 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string sensitivityLabelSource = "recommended"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1261,40 +1717,29 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("skipToken", skipToken); - tracingParameters.Add("count", count); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (skipToken != null) - { - _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); - } - if (count != null) - { - _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1306,7 +1751,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1392,31 +1837,13 @@ internal ManagedDatabaseSensitivityLabelsOperations(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); @@ -1425,7 +1852,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) } /// - /// Update sensitivity labels of a given database using an operations batch. + /// Gets the sensitivity labels of a given database /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1437,7 +1864,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the database. /// - /// + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -1448,6 +1876,9 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1457,7 +1888,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1471,15 +1902,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1487,22 +1914,30 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1514,7 +1949,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1545,12 +1980,6 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1606,13 +2035,31 @@ internal ManagedDatabaseSensitivityLabelsOperations(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); @@ -1623,23 +2070,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// Gets the sensitivity labels of a given database /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The name of the database. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// - /// - /// Specifies whether to include disabled recommendations or not. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1662,25 +2094,12 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (managedInstanceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1688,44 +2107,14 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("skipToken", skipToken); - tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabaseNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (skipToken != null) - { - _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); - } - if (includeDisabledRecommendations != null) - { - _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1878,7 +2267,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1893,7 +2282,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2051,7 +2440,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2066,7 +2455,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs index c69fc7581d307..2eb5b2e95234d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedDatabaseSensitivityLabelsOperationsExtensions { /// - /// Gets the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// /// /// The operations group for this extension method. @@ -38,26 +38,20 @@ public static partial class ManagedDatabaseSensitivityLabelsOperationsExtensions /// /// The name of the database. /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. + /// + /// OData parameters to apply to the operation. /// - /// - /// The name of the column. + /// /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' + /// /// - public static SensitivityLabel Get(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) + public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) { - return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).GetAwaiter().GetResult(); + return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); } /// - /// Gets the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// /// /// The operations group for this extension method. @@ -72,32 +66,26 @@ public static SensitivityLabel Get(this IManagedDatabaseSensitivityLabelsOperati /// /// The name of the database. /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. + /// + /// OData parameters to apply to the operation. /// - /// - /// The name of the column. + /// /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' + /// /// /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or updates the sensitivity label of a given column + /// Update sensitivity labels of a given database using an operations batch. /// /// /// The operations group for this extension method. @@ -112,25 +100,41 @@ public static SensitivityLabel Get(this IManagedDatabaseSensitivityLabelsOperati /// /// The name of the database. /// - /// - /// The name of the schema. + /// /// - /// - /// The name of the table. + public static void Update(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. /// - /// - /// The name of the column. + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. /// /// - /// The column sensitivity label resource. /// - public static SensitivityLabel CreateOrUpdate(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters) + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters).GetAwaiter().GetResult(); + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Creates or updates the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// /// /// The operations group for this extension method. @@ -145,31 +149,56 @@ public static SensitivityLabel CreateOrUpdate(this IManagedDatabaseSensitivityLa /// /// The name of the database. /// - /// - /// The name of the schema. + /// + /// OData parameters to apply to the operation. /// - /// - /// The name of the table. + /// /// - /// - /// The name of the column. + /// + /// Specifies whether to include disabled recommendations or not. /// - /// - /// The column sensitivity label resource. + public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) + { + return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); + } + + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// + /// + /// Specifies whether to include disabled recommendations or not. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes the sensitivity label of a given column + /// Gets the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -193,13 +222,17 @@ public static SensitivityLabel CreateOrUpdate(this IManagedDatabaseSensitivityLa /// /// The name of the column. /// - public static void Delete(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' + /// + public static SensitivityLabel Get(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { - operations.DeleteAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).GetAwaiter().GetResult(); } /// - /// Deletes the sensitivity label of a given column + /// Gets the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -223,16 +256,23 @@ public static void Delete(this IManagedDatabaseSensitivityLabelsOperations opera /// /// The name of the column. /// + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -256,13 +296,16 @@ public static void Delete(this IManagedDatabaseSensitivityLabelsOperations opera /// /// The name of the column. /// - public static void DisableRecommendation(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + /// + /// The column sensitivity label resource. + /// + public static SensitivityLabel CreateOrUpdate(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters) { - operations.DisableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters).GetAwaiter().GetResult(); } /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -286,17 +329,22 @@ public static void DisableRecommendation(this IManagedDatabaseSensitivityLabelsO /// /// The name of the column. /// + /// + /// The column sensitivity label resource. + /// /// /// The cancellation token. /// - public static async Task DisableRecommendationAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DisableRecommendationWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Deletes the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -320,14 +368,13 @@ public static void DisableRecommendation(this IManagedDatabaseSensitivityLabelsO /// /// The name of the column. /// - public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + public static void Delete(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) { - operations.EnableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Deletes the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -354,13 +401,13 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// The cancellation token. /// - public static async Task EnableRecommendationAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.EnableRecommendationWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets the sensitivity labels of a given database + /// Disables sensitivity recommendations on a given column /// /// /// The operations group for this extension method. @@ -375,20 +422,22 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// The name of the database. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the schema. /// - /// + /// + /// The name of the table. /// - /// + /// + /// The name of the column. /// - public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) + public static void DisableRecommendation(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) { - return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); + operations.DisableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Gets the sensitivity labels of a given database + /// Disables sensitivity recommendations on a given column /// /// /// The operations group for this extension method. @@ -403,26 +452,26 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// The name of the database. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the schema. /// - /// + /// + /// The name of the table. /// - /// + /// + /// The name of the column. /// /// /// The cancellation token. /// - public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DisableRecommendationAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DisableRecommendationWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Update sensitivity labels of a given database using an operations batch. + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The operations group for this extension method. @@ -437,15 +486,23 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// The name of the database. /// - /// + /// + /// The name of the schema. /// - public static void Update(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters) + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) { - operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + operations.EnableRecommendationAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Update sensitivity labels of a given database using an operations batch. + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The operations group for this extension method. @@ -460,14 +517,21 @@ public static void Update(this IManagedDatabaseSensitivityLabelsOperations opera /// /// The name of the database. /// - /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task EnableRecommendationAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.EnableRecommendationWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -489,14 +553,9 @@ public static void Update(this IManagedDatabaseSensitivityLabelsOperations opera /// /// OData parameters to apply to the operation. /// - /// - /// - /// - /// Specifies whether to include disabled recommendations or not. - /// - public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) + public static IPage ListByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery).GetAwaiter().GetResult(); } /// @@ -518,17 +577,12 @@ public static void Update(this IManagedDatabaseSensitivityLabelsOperations opera /// /// OData parameters to apply to the operation. /// - /// - /// - /// - /// Specifies whether to include disabled recommendations or not. - /// /// /// The cancellation token. /// - public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -602,5 +656,39 @@ public static IPage ListRecommendedByDatabaseNext(this IManage } } + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseSensitivityLabelsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperations.cs new file mode 100644 index 0000000000000..48534021d2f5e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperations.cs @@ -0,0 +1,1340 @@ +// +// 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; + + /// + /// ManagedServerDnsAliasesOperations operations. + /// + internal partial class ManagedServerDnsAliasesOperations : IServiceOperations, IManagedServerDnsAliasesOperations + { + /// + /// Initializes a new instance of the ManagedServerDnsAliasesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedServerDnsAliasesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (dnsAliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dnsAliasName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("dnsAliasName", dnsAliasName); + 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/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAcquireWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (dnsAliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dnsAliasName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("dnsAliasName", dnsAliasName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (dnsAliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dnsAliasName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("dnsAliasName", dnsAliasName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (dnsAliasName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dnsAliasName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("dnsAliasName", dnsAliasName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAcquire", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{dnsAliasName}", System.Uri.EscapeDataString(dnsAliasName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperationsExtensions.cs new file mode 100644 index 0000000000000..196f59d942512 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperationsExtensions.cs @@ -0,0 +1,433 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedServerDnsAliasesOperations. + /// + public static partial class ManagedServerDnsAliasesOperationsExtensions + { + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + public static IPage ListByManagedInstance(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + public static ManagedServerDnsAlias Get(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, dnsAliasName).GetAwaiter().GetResult(); + } + + /// + /// Gets a server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedServerDnsAlias CreateOrUpdate(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + public static void Delete(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + operations.DeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedServerDnsAlias Acquire(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters) + { + return operations.AcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task AcquireAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AcquireWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedServerDnsAlias BeginCreateOrUpdate(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a managed server DNS alias. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasCreation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + public static void BeginDelete(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName) + { + operations.BeginDeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the managed server DNS alias with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + public static ManagedServerDnsAlias BeginAcquire(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters) + { + return operations.BeginAcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Acquires managed server DNS alias from another managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginAcquireAsync(this IManagedServerDnsAliasesOperations operations, string resourceGroupName, string managedInstanceName, string dnsAliasName, ManagedServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginAcquireWithHttpMessagesAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedInstanceNext(this IManagedServerDnsAliasesOperations operations, string nextPageLink) + { + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed server DNS aliases for a managed server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceNextAsync(this IManagedServerDnsAliasesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs index c5c3c64c7a2f2..f282d44290f14 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Database.cs @@ -206,9 +206,6 @@ public Database() /// for this database. /// The Client id used for cross tenant /// per database CMK scenario - /// The Primary - /// Delegated Identity Client id used for per database CMK - for - /// internal use only /// The resource identifier of the /// source associated with the create operation of this database. /// @@ -236,7 +233,7 @@ public Database() /// “x-ms-authorization-auxiliary” header see /// https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant /// - public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), DatabaseIdentity identity = default(DatabaseIdentity), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?), System.Guid? federatedClientId = default(System.Guid?), System.Guid? primaryDelegatedIdentityClientId = default(System.Guid?), string sourceResourceId = default(string)) + public Database(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string managedBy = default(string), DatabaseIdentity identity = default(DatabaseIdentity), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?), System.Guid? federatedClientId = default(System.Guid?), string sourceResourceId = default(string)) : base(location, id, name, type, tags) { Sku = sku; @@ -281,7 +278,6 @@ public Database() IsLedgerOn = isLedgerOn; IsInfraEncryptionEnabled = isInfraEncryptionEnabled; FederatedClientId = federatedClientId; - PrimaryDelegatedIdentityClientId = primaryDelegatedIdentityClientId; SourceResourceId = sourceResourceId; CustomInit(); } @@ -644,13 +640,6 @@ public Database() [JsonProperty(PropertyName = "properties.federatedClientId")] public System.Guid? FederatedClientId { get; set; } - /// - /// Gets or sets the Primary Delegated Identity Client id used for per - /// database CMK - for internal use only - /// - [JsonProperty(PropertyName = "properties.primaryDelegatedIdentityClientId")] - public System.Guid? PrimaryDelegatedIdentityClientId { get; set; } - /// /// Gets or sets the resource identifier of the source associated with /// the create operation of this database. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseIdentity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseIdentity.cs index 32e6145596021..56dc6a20bea46 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseIdentity.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseIdentity.cs @@ -37,14 +37,11 @@ public DatabaseIdentity() /// id. /// The resource ids of the user /// assigned identities to use - /// Resources delegated to the - /// database - Internal Use Only - public DatabaseIdentity(string type = default(string), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary), IDictionary delegatedResources = default(IDictionary)) + public DatabaseIdentity(string type = default(string), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary)) { Type = type; TenantId = tenantId; UserAssignedIdentities = userAssignedIdentities; - DelegatedResources = delegatedResources; CustomInit(); } @@ -73,12 +70,5 @@ public DatabaseIdentity() [JsonProperty(PropertyName = "userAssignedIdentities")] public IDictionary UserAssignedIdentities { get; set; } - /// - /// Gets or sets resources delegated to the database - Internal Use - /// Only - /// - [JsonProperty(PropertyName = "delegatedResources")] - public IDictionary DelegatedResources { get; set; } - } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs index 7f880478b16a9..fad5a1679c9cb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUpdate.cs @@ -182,11 +182,8 @@ public DatabaseUpdate() /// for this database. /// The Client id used for cross tenant /// per database CMK scenario - /// The Primary - /// Delegated Identity Client id used for per database CMK - for - /// internal use only /// Resource tags. - public DatabaseUpdate(Sku sku = default(Sku), DatabaseIdentity identity = default(DatabaseIdentity), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?), System.Guid? federatedClientId = default(System.Guid?), System.Guid? primaryDelegatedIdentityClientId = default(System.Guid?), IDictionary tags = default(IDictionary)) + public DatabaseUpdate(Sku sku = default(Sku), DatabaseIdentity identity = default(DatabaseIdentity), string createMode = default(string), string collation = default(string), long? maxSizeBytes = default(long?), string sampleName = default(string), string elasticPoolId = default(string), string sourceDatabaseId = default(string), string status = default(string), System.Guid? databaseId = default(System.Guid?), System.DateTime? creationDate = default(System.DateTime?), string currentServiceObjectiveName = default(string), string requestedServiceObjectiveName = default(string), string defaultSecondaryLocation = default(string), string failoverGroupId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), System.DateTime? sourceDatabaseDeletionDate = default(System.DateTime?), string recoveryServicesRecoveryPointId = default(string), string longTermRetentionBackupResourceId = default(string), string recoverableDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string catalogCollation = default(string), bool? zoneRedundant = default(bool?), string licenseType = default(string), long? maxLogSizeBytes = default(long?), System.DateTime? earliestRestoreDate = default(System.DateTime?), string readScale = default(string), int? highAvailabilityReplicaCount = default(int?), string secondaryType = default(string), Sku currentSku = default(Sku), int? autoPauseDelay = default(int?), string currentBackupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), bool? isLedgerOn = default(bool?), bool? isInfraEncryptionEnabled = default(bool?), System.Guid? federatedClientId = default(System.Guid?), IDictionary tags = default(IDictionary)) { Sku = sku; Identity = identity; @@ -228,7 +225,6 @@ public DatabaseUpdate() IsLedgerOn = isLedgerOn; IsInfraEncryptionEnabled = isInfraEncryptionEnabled; FederatedClientId = federatedClientId; - PrimaryDelegatedIdentityClientId = primaryDelegatedIdentityClientId; Tags = tags; CustomInit(); } @@ -563,13 +559,6 @@ public DatabaseUpdate() [JsonProperty(PropertyName = "properties.federatedClientId")] public System.Guid? FederatedClientId { get; set; } - /// - /// Gets or sets the Primary Delegated Identity Client id used for per - /// database CMK - for internal use only - /// - [JsonProperty(PropertyName = "properties.primaryDelegatedIdentityClientId")] - public System.Guid? PrimaryDelegatedIdentityClientId { get; set; } - /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Delegation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Delegation.cs deleted file mode 100644 index 0bc3e28727eee..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Delegation.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Delegated Resource Properties - Internal Use Only - /// - public partial class Delegation - { - /// - /// Initializes a new instance of the Delegation class. - /// - public Delegation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Delegation class. - /// - /// The resource id of the source resource - - /// Internal Use Only - /// AAD tenant guid of the source resource - /// identity - Internal Use Only. - public Delegation(string resourceId = default(string), System.Guid? tenantId = default(System.Guid?)) - { - ResourceId = resourceId; - TenantId = tenantId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource id of the source resource - Internal Use - /// Only - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } - - /// - /// Gets AAD tenant guid of the source resource identity - Internal Use - /// Only. - /// - [JsonProperty(PropertyName = "tenantId")] - public System.Guid? TenantId { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAlias.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAlias.cs new file mode 100644 index 0000000000000..826cf94c2b36e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAlias.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A managed server DNS alias. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedServerDnsAlias : ProxyResource + { + /// + /// Initializes a new instance of the ManagedServerDnsAlias class. + /// + public ManagedServerDnsAlias() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServerDnsAlias class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The fully qualified DNS record for + /// managed server alias + public ManagedServerDnsAlias(string id = default(string), string name = default(string), string type = default(string), string azureDnsRecord = default(string)) + : base(id, name, type) + { + AzureDnsRecord = azureDnsRecord; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified DNS record for managed server alias + /// + [JsonProperty(PropertyName = "properties.azureDnsRecord")] + public string AzureDnsRecord { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs new file mode 100644 index 0000000000000..52e9ddd88255a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A managed server DNS alias acquisition request. + /// + public partial class ManagedServerDnsAliasAcquisition + { + /// + /// Initializes a new instance of the ManagedServerDnsAliasAcquisition + /// class. + /// + public ManagedServerDnsAliasAcquisition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServerDnsAliasAcquisition + /// class. + /// + /// The resource ID of + /// the managed server DNS alias that will be acquired to point to this + /// managed server instead. + public ManagedServerDnsAliasAcquisition(string oldManagedServerDnsAliasResourceId) + { + OldManagedServerDnsAliasResourceId = oldManagedServerDnsAliasResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the managed server DNS alias that + /// will be acquired to point to this managed server instead. + /// + [JsonProperty(PropertyName = "oldManagedServerDnsAliasResourceId")] + public string OldManagedServerDnsAliasResourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OldManagedServerDnsAliasResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OldManagedServerDnsAliasResourceId"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs similarity index 53% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs index 9797c1a9fdc48..77f0176e74aa4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs @@ -11,29 +11,31 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// A list of IPv6 server firewall rules. + /// A managed server dns alias creation request. /// - public partial class IPv6FirewallRuleList + public partial class ManagedServerDnsAliasCreation { /// - /// Initializes a new instance of the IPv6FirewallRuleList class. + /// Initializes a new instance of the ManagedServerDnsAliasCreation + /// class. /// - public IPv6FirewallRuleList() + public ManagedServerDnsAliasCreation() { CustomInit(); } /// - /// Initializes a new instance of the IPv6FirewallRuleList class. + /// Initializes a new instance of the ManagedServerDnsAliasCreation + /// class. /// - public IPv6FirewallRuleList(IList values = default(IList)) + /// Whether or not DNS record should be + /// created for this alias. + public ManagedServerDnsAliasCreation(bool? createDnsRecord = default(bool?)) { - Values = values; + CreateDnsRecord = createDnsRecord; CustomInit(); } @@ -43,9 +45,11 @@ public IPv6FirewallRuleList() partial void CustomInit(); /// + /// Gets or sets whether or not DNS record should be created for this + /// alias. /// - [JsonProperty(PropertyName = "values")] - public IList Values { get; set; } + [JsonProperty(PropertyName = "createDnsRecord")] + public bool? CreateDnsRecord { get; set; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs deleted file mode 100644 index 773e905009a08..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the parameters for Unlink Replication Link request. - /// - public partial class UnlinkParameters - { - /// - /// Initializes a new instance of the UnlinkParameters class. - /// - public UnlinkParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UnlinkParameters class. - /// - /// Determines whether link will be - /// terminated in a forced or a friendly way. - public UnlinkParameters(bool? forcedTermination = default(bool?)) - { - ForcedTermination = forcedTermination; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets determines whether link will be terminated in a forced - /// or a friendly way. - /// - [JsonProperty(PropertyName = "forcedTermination")] - public bool? ForcedTermination { get; set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs index 71e46e0c31ca0..bd26dd99867da 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs @@ -106,7 +106,7 @@ internal RecommendedSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs index 64ddd37e63c9d..2cb48749e5f3a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperations.cs @@ -51,7 +51,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,10 +61,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database that has the replication link to be dropped. - /// - /// - /// The ID of the replication link to be deleted. + /// The name of the database. /// /// /// Headers that will be added to request. @@ -75,6 +72,9 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -84,12 +84,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -102,11 +98,11 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (linkId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,22 +110,20 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -142,7 +136,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -193,7 +187,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -228,13 +222,31 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -301,7 +313,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-02-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -456,8 +468,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Deletes the replication link. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -467,98 +478,9 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task UnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginUnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of replication links on database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. /// /// /// Headers that will be added to request. @@ -569,9 +491,6 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -581,7 +500,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -595,11 +514,15 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (linkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-02-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -610,16 +533,18 @@ internal ReplicationLinksOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("linkId", linkId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -633,7 +558,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -719,31 +644,13 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -751,6 +658,65 @@ internal ReplicationLinksOperations(SqlManagementClient client) return _result; } + /// + /// Fails over from the current primary server to this server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the replication link. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> FailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fails over from the current primary server to this server allowing data + /// loss. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the replication link. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> FailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Gets a list of replication links. /// @@ -796,7 +762,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-02-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -947,8 +913,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Fails over from the current primary server to this server. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -958,10 +923,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// Headers that will be added to request. @@ -972,6 +937,9 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -981,12 +949,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1003,7 +967,11 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1011,22 +979,22 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("linkId", linkId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -1090,7 +1058,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1125,205 +1093,30 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (linkId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); - } - string apiVersion = "2014-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("linkId", linkId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverAllowDataLoss", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) + // Deserialize Response + if ((int)_statusCode == 200) { - foreach(var _header in customHeaders) + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try + catch (JsonException ex) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) + _httpRequest.Dispose(); + if (_httpResponse != null) { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; + _httpResponse.Dispose(); } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { @@ -1333,7 +1126,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) } /// - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server allowing data + /// loss. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1343,13 +1137,10 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the replication link. /// /// /// Headers that will be added to request. @@ -1360,6 +1151,9 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1369,12 +1163,8 @@ internal ReplicationLinksOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginUnlinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginFailoverAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1391,11 +1181,11 @@ internal ReplicationLinksOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); } - if (parameters == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1403,23 +1193,22 @@ internal ReplicationLinksOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("linkId", linkId); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUnlink", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverAllowDataLoss", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -1463,12 +1252,6 @@ internal ReplicationLinksOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1489,7 +1272,7 @@ internal ReplicationLinksOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1524,13 +1307,31 @@ internal ReplicationLinksOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs index 5cfcc87028232..b5e56b6e2ffae 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ReplicationLinksOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ReplicationLinksOperationsExtensions { /// - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -35,18 +35,15 @@ public static partial class ReplicationLinksOperationsExtensions /// The name of the server. /// /// - /// The name of the database that has the replication link to be dropped. - /// - /// - /// The ID of the replication link to be deleted. + /// The name of the database. /// - public static void Delete(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static IPage ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) { - operations.DeleteAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Deletes a database replication link. Cannot be done during failover. + /// Gets a list of replication links on database. /// /// /// The operations group for this extension method. @@ -59,17 +56,17 @@ public static void Delete(this IReplicationLinksOperations operations, string re /// The name of the server. /// /// - /// The name of the database that has the replication link to be dropped. - /// - /// - /// The ID of the replication link to be deleted. + /// The name of the database. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -127,8 +124,7 @@ public static ReplicationLink Get(this IReplicationLinksOperations operations, s } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Deletes the replication link. /// /// /// The operations group for this extension method. @@ -141,19 +137,17 @@ public static ReplicationLink Get(this IReplicationLinksOperations operations, s /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. /// - public static void Failover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static void Delete(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - operations.FailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. + /// Deletes the replication link. /// /// /// The operations group for this extension method. @@ -166,22 +160,20 @@ public static void Failover(this IReplicationLinksOperations operations, string /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. /// /// /// The cancellation token. /// - public static async Task FailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server. /// /// /// The operations group for this extension method. @@ -194,19 +186,18 @@ public static void Failover(this IReplicationLinksOperations operations, string /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// - public static void FailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static ReplicationLink Failover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - operations.FailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.FailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server. /// /// /// The operations group for this extension method. @@ -219,48 +210,25 @@ public static void FailoverAllowDataLoss(this IReplicationLinksOperations operat /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task FailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.FailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes a database replication link in forced or friendly way. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - public static void Unlink(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) + public static async Task FailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - operations.UnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); + using (var _result = await operations.FailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server allowing data + /// loss. /// /// /// The operations group for this extension method. @@ -273,24 +241,19 @@ public static void Unlink(this IReplicationLinksOperations operations, string re /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. - /// - /// - /// The cancellation token. + /// The name of the replication link. /// - public static async Task UnlinkAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static ReplicationLink FailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - (await operations.UnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return operations.FailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Gets a list of replication links on database. + /// Fails over from the current primary server to this server allowing data + /// loss. /// /// /// The operations group for this extension method. @@ -305,33 +268,15 @@ public static void Unlink(this IReplicationLinksOperations operations, string re /// /// The name of the database. /// - public static IPage ListByDatabase(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName) - { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of replication links on database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. + /// + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task FailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.FailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -380,61 +325,7 @@ public static IPage ListByServer(this IReplicationLinksOperatio } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - public static void BeginFailover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) - { - operations.BeginFailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database that has the replication link to be failed over. - /// - /// - /// The ID of the replication link to be failed over. - /// - /// - /// The cancellation token. - /// - public static async Task BeginFailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server. /// /// /// The operations group for this extension method. @@ -447,19 +338,18 @@ public static void BeginFailover(this IReplicationLinksOperations operations, st /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// - public static void BeginFailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) + public static ReplicationLink BeginFailover(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - operations.BeginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); + return operations.BeginFailoverAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Sets which replica database is primary by failing over from the current - /// primary replica database. This operation might result in data loss. + /// Fails over from the current primary server to this server. /// /// /// The operations group for this extension method. @@ -472,21 +362,25 @@ public static void BeginFailoverAllowDataLoss(this IReplicationLinksOperations o /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task BeginFailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginFailoverAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server allowing data + /// loss. /// /// /// The operations group for this extension method. @@ -499,21 +393,19 @@ public static void BeginFailoverAllowDataLoss(this IReplicationLinksOperations o /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the replication link. /// - public static void BeginUnlink(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) + public static ReplicationLink BeginFailoverAllowDataLoss(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId) { - operations.BeginUnlinkAsync(resourceGroupName, serverName, databaseName, linkId, parameters).GetAwaiter().GetResult(); + return operations.BeginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).GetAwaiter().GetResult(); } /// - /// Deletes a database replication link in forced or friendly way. + /// Fails over from the current primary server to this server allowing data + /// loss. /// /// /// The operations group for this extension method. @@ -526,20 +418,20 @@ public static void BeginUnlink(this IReplicationLinksOperations operations, stri /// The name of the server. /// /// - /// The name of the database that has the replication link to be failed over. + /// The name of the database. /// /// - /// The ID of the replication link to be failed over. - /// - /// - /// The required parameters for unlinking replication link. + /// The name of the replication link. /// /// /// The cancellation token. /// - public static async Task BeginUnlinkAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginFailoverAllowDataLossAsync(this IReplicationLinksOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginUnlinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginFailoverAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs index a8987005c1f21..8675647211f47 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 @@ -53,7 +53,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "FailoverGroups", "2020-11-01-preview"), new Tuple("Sql", "FirewallRules", "2020-11-01-preview"), new Tuple("Sql", "GeoBackupPolicies", "2014-04-01"), - new Tuple("Sql", "IPv6FirewallRules", "2021-08-01-preview"), + new Tuple("Sql", "IPv6FirewallRules", "2021-11-01-preview"), new Tuple("Sql", "InstanceFailoverGroups", "2020-11-01-preview"), new Tuple("Sql", "InstancePools", "2020-11-01-preview"), new Tuple("Sql", "JobAgents", "2020-11-01-preview"), @@ -74,12 +74,12 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseColumns", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseQueries", "2020-11-01-preview"), - new Tuple("Sql", "ManagedDatabaseRecommendedSensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseRecommendedSensitivityLabels", "2021-11-01-preview"), new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseSchemas", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseSecurityEvents", "2020-11-01-preview"), - new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2021-11-01-preview"), new Tuple("Sql", "ManagedDatabaseTables", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseTransparentDataEncryption", "2020-11-01-preview"), new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2020-11-01-preview"), @@ -98,20 +98,20 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2020-11-01-preview"), new Tuple("Sql", "ManagedInstances", "2021-05-01-preview"), new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ManagedServerDnsAliases", "2021-11-01-preview"), new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2020-11-01-preview"), new Tuple("Sql", "Operations", "2020-11-01-preview"), new Tuple("Sql", "OutboundFirewallRules", "2021-02-01-preview"), new Tuple("Sql", "PrivateEndpointConnections", "2020-11-01-preview"), new Tuple("Sql", "PrivateLinkResources", "2020-11-01-preview"), - new Tuple("Sql", "RecommendedSensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "RecommendedSensitivityLabels", "2021-11-01-preview"), new Tuple("Sql", "RecoverableDatabases", "2014-04-01"), new Tuple("Sql", "RecoverableManagedDatabases", "2020-11-01-preview"), - new Tuple("Sql", "ReplicationLinks", "2014-04-01"), - new Tuple("Sql", "ReplicationLinks", "2021-02-01-preview"), + new Tuple("Sql", "ReplicationLinks", "2021-11-01-preview"), new Tuple("Sql", "RestorableDroppedDatabases", "2021-05-01-preview"), new Tuple("Sql", "RestorableDroppedManagedDatabases", "2021-05-01-preview"), new Tuple("Sql", "RestorePoints", "2020-11-01-preview"), - new Tuple("Sql", "SensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "SensitivityLabels", "2021-11-01-preview"), new Tuple("Sql", "ServerAdvisors", "2020-11-01-preview"), new Tuple("Sql", "ServerAutomaticTuning", "2020-11-01-preview"), new Tuple("Sql", "ServerAzureADAdministrators", "2020-11-01-preview"), @@ -146,15 +146,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } - public static readonly String AutoRestVersion = "2.0.4421"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.5.1"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/sql/resource-manager/readme.md --csharp --version=2.0.4421 --reflect-api-versions --csharp-sdks-folder=D:\\OpenSourceProjects\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "2b92c256213dfd230dabe819bb901c197188773a"; - 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/SensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs index c033488914ca5..c3b5bb9815646 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs @@ -110,7 +110,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -336,7 +336,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -537,7 +537,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -709,8 +709,510 @@ internal SensitivityLabelsOperations(SqlManagementClient client) } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Gets the sensitivity label of a given column + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the sensitivity label of a given column + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The column sensitivity label resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string sensitivityLabelSource = "current"; + string apiVersion = "2021-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the sensitivity label of a given column /// /// /// The name of the resource group that contains the resource. You can obtain @@ -749,7 +1251,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -779,8 +1281,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string sensitivityLabelSource = "recommended"; - string apiVersion = "2020-11-01-preview"; + string sensitivityLabelSource = "current"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -797,11 +1299,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").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)); @@ -822,7 +1324,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -993,7 +1495,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1136,7 +1638,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) } /// - /// Gets the sensitivity label of a given column + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1157,10 +1660,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the column. /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' - /// /// /// Headers that will be added to request. /// @@ -1170,9 +1669,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1182,7 +1678,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1212,7 +1708,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-11-01-preview"; + string sensitivityLabelSource = "recommended"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1229,18 +1726,18 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); - _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(sensitivityLabelSource, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -1254,7 +1751,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1340,31 +1837,13 @@ internal SensitivityLabelsOperations(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); @@ -1373,7 +1852,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) } /// - /// Creates or updates the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1385,17 +1864,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// The name of the database. /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. - /// - /// - /// The name of the column. - /// - /// - /// The column sensitivity label resource. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -1418,7 +1888,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1432,28 +1902,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (schemaName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (columnName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string sensitivityLabelSource = "current"; - string apiVersion = "2020-11-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1461,30 +1914,30 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("schemaName", schemaName); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("columnName", columnName); - tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); - _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1496,7 +1949,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1527,12 +1980,6 @@ internal SensitivityLabelsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1553,7 +2000,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1588,7 +2035,7 @@ internal SensitivityLabelsOperations(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")) @@ -1601,25 +2048,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1639,26 +2068,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) } /// - /// Deletes the sensitivity label of a given column + /// Gets the sensitivity labels of a given database /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The name of the schema. - /// - /// - /// The name of the table. - /// - /// - /// The name of the column. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1669,6 +2082,9 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1678,38 +2094,12 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (schemaName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (columnName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string sensitivityLabelSource = "current"; - string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1717,33 +2107,14 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("schemaName", schemaName); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("columnName", columnName); - tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabaseNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); - _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1751,7 +2122,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1837,13 +2208,31 @@ internal SensitivityLabelsOperations(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); @@ -1878,7 +2267,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1893,7 +2282,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2051,7 +2440,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2066,7 +2455,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs index 16d2060007674..bad4e1db77f4a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs @@ -198,8 +198,7 @@ public static void Update(this ISensitivityLabelsOperations operations, string r } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Gets the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -223,14 +222,17 @@ public static void Update(this ISensitivityLabelsOperations operations, string r /// /// The name of the column. /// - public static void EnableRecommendation(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' + /// + public static SensitivityLabel Get(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { - operations.EnableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).GetAwaiter().GetResult(); } /// - /// Enables sensitivity recommendations on a given column (recommendations are - /// enabled by default on all columns) + /// Gets the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -254,16 +256,23 @@ public static void EnableRecommendation(this ISensitivityLabelsOperations operat /// /// The name of the column. /// + /// + /// The source of the sensitivity label. Possible values include: 'current', + /// 'recommended' + /// /// /// The cancellation token. /// - public static async Task EnableRecommendationAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.EnableRecommendationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -287,13 +296,16 @@ public static void EnableRecommendation(this ISensitivityLabelsOperations operat /// /// The name of the column. /// - public static void DisableRecommendation(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + /// + /// The column sensitivity label resource. + /// + public static SensitivityLabel CreateOrUpdate(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters) { - operations.DisableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).GetAwaiter().GetResult(); } /// - /// Disables sensitivity recommendations on a given column + /// Creates or updates the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -317,16 +329,22 @@ public static void DisableRecommendation(this ISensitivityLabelsOperations opera /// /// The name of the column. /// + /// + /// The column sensitivity label resource. + /// /// /// The cancellation token. /// - public static async Task DisableRecommendationAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DisableRecommendationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets the sensitivity label of a given column + /// Deletes the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -350,17 +368,13 @@ public static void DisableRecommendation(this ISensitivityLabelsOperations opera /// /// The name of the column. /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' - /// - public static SensitivityLabel Get(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) + public static void Delete(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Gets the sensitivity label of a given column + /// Deletes the sensitivity label of a given column /// /// /// The operations group for this extension method. @@ -384,23 +398,16 @@ public static SensitivityLabel Get(this ISensitivityLabelsOperations operations, /// /// The name of the column. /// - /// - /// The source of the sensitivity label. Possible values include: 'current', - /// 'recommended' - /// /// /// The cancellation token. /// - public static async Task GetAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Creates or updates the sensitivity label of a given column + /// Disables sensitivity recommendations on a given column /// /// /// The operations group for this extension method. @@ -424,16 +431,13 @@ public static SensitivityLabel Get(this ISensitivityLabelsOperations operations, /// /// The name of the column. /// - /// - /// The column sensitivity label resource. - /// - public static SensitivityLabel CreateOrUpdate(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters) + public static void DisableRecommendation(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).GetAwaiter().GetResult(); + operations.DisableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Creates or updates the sensitivity label of a given column + /// Disables sensitivity recommendations on a given column /// /// /// The operations group for this extension method. @@ -457,22 +461,17 @@ public static SensitivityLabel CreateOrUpdate(this ISensitivityLabelsOperations /// /// The name of the column. /// - /// - /// The column sensitivity label resource. - /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DisableRecommendationAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.DisableRecommendationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Deletes the sensitivity label of a given column + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The operations group for this extension method. @@ -496,13 +495,14 @@ public static SensitivityLabel CreateOrUpdate(this ISensitivityLabelsOperations /// /// The name of the column. /// - public static void Delete(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + public static void EnableRecommendation(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { - operations.DeleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + operations.EnableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); } /// - /// Deletes the sensitivity label of a given column + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) /// /// /// The operations group for this extension method. @@ -529,9 +529,63 @@ public static void Delete(this ISensitivityLabelsOperations operations, string r /// /// The cancellation token. /// - public static async Task DeleteAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task EnableRecommendationAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.EnableRecommendationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -602,5 +656,39 @@ public static IPage ListRecommendedByDatabaseNext(this ISensit } } + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ISensitivityLabelsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the sensitivity labels of a given database + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this ISensitivityLabelsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs index bcc439ccb95dc..08da5d190ced0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -102,11 +102,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IElasticPoolsOperations ElasticPools { get; private set; } - /// - /// Gets the IReplicationLinksOperations. - /// - public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } - /// /// Gets the IServerCommunicationLinksOperations. /// @@ -347,16 +342,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; private set; } - /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. - /// - public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } - - /// - /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. - /// - public virtual IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; private set; } - /// /// Gets the IManagedDatabaseTablesOperations. /// @@ -467,16 +452,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IRestorePointsOperations RestorePoints { get; private set; } - /// - /// Gets the ISensitivityLabelsOperations. - /// - public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } - - /// - /// Gets the IRecommendedSensitivityLabelsOperations. - /// - public virtual IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; private set; } - /// /// Gets the IServerAdvisorsOperations. /// @@ -677,6 +652,36 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IIPv6FirewallRulesOperations IPv6FirewallRules { get; private set; } + /// + /// Gets the IReplicationLinksOperations. + /// + public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } + + /// + /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// + public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } + + /// + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. + /// + public virtual IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; private set; } + + /// + /// Gets the IManagedServerDnsAliasesOperations. + /// + public virtual IManagedServerDnsAliasesOperations ManagedServerDnsAliases { get; private set; } + + /// + /// Gets the ISensitivityLabelsOperations. + /// + public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } + + /// + /// Gets the IRecommendedSensitivityLabelsOperations. + /// + public virtual IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; private set; } + /// /// Initializes a new instance of the SqlManagementClient class. /// @@ -924,7 +929,6 @@ private void Initialize() GeoBackupPolicies = new GeoBackupPoliciesOperations(this); Databases = new DatabasesOperations(this); ElasticPools = new ElasticPoolsOperations(this); - ReplicationLinks = new ReplicationLinksOperations(this); ServerCommunicationLinks = new ServerCommunicationLinksOperations(this); ServiceObjectives = new ServiceObjectivesOperations(this); ElasticPoolActivities = new ElasticPoolActivitiesOperations(this); @@ -973,8 +977,6 @@ private void Initialize() ManagedDatabaseSchemas = new ManagedDatabaseSchemasOperations(this); ManagedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesOperations(this); ManagedDatabaseSecurityEvents = new ManagedDatabaseSecurityEventsOperations(this); - ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); - ManagedDatabaseRecommendedSensitivityLabels = new ManagedDatabaseRecommendedSensitivityLabelsOperations(this); ManagedDatabaseTables = new ManagedDatabaseTablesOperations(this); ManagedDatabaseTransparentDataEncryption = new ManagedDatabaseTransparentDataEncryptionOperations(this); ManagedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); @@ -997,8 +999,6 @@ private void Initialize() PrivateLinkResources = new PrivateLinkResourcesOperations(this); RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); RestorePoints = new RestorePointsOperations(this); - SensitivityLabels = new SensitivityLabelsOperations(this); - RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); ServerAdvisors = new ServerAdvisorsOperations(this); ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(this); @@ -1039,6 +1039,12 @@ private void Initialize() DistributedAvailabilityGroups = new DistributedAvailabilityGroupsOperations(this); ServerTrustCertificates = new ServerTrustCertificatesOperations(this); IPv6FirewallRules = new IPv6FirewallRulesOperations(this); + ReplicationLinks = new ReplicationLinksOperations(this); + ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); + ManagedDatabaseRecommendedSensitivityLabels = new ManagedDatabaseRecommendedSensitivityLabelsOperations(this); + ManagedServerDnsAliases = new ManagedServerDnsAliasesOperations(this); + SensitivityLabels = new SensitivityLabelsOperations(this); + RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30;