From 727dee1760e5a1f560d151c797724fb65abe3c86 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 30 Mar 2022 18:04:38 +0000 Subject: [PATCH] CodeGen from PR 18467 in Azure/azure-rest-api-specs Merge d759cf1faa0ab5e36d2632e9f2e9656e16c6ba00 into 2a939260357e0cba34cf9fba1d428b2da16dfa5e --- ...agedDatabaseSensitivityLabelsOperations.cs | 151 +- .../Generated/IManagedInstancesOperations.cs | 139 +- .../IManagedServerDnsAliasesOperations.cs | 281 ++++ .../Generated/IReplicationLinksOperations.cs | 135 +- .../Generated/ISensitivityLabelsOperations.cs | 103 +- .../src/Generated/IServersOperations.cs | 96 +- .../src/Generated/ISqlManagementClient.cs | 75 +- ...eRecommendedSensitivityLabelsOperations.cs | 2 +- ...agedDatabaseSensitivityLabelsOperations.cs | 881 ++++++++--- ...seSensitivityLabelsOperationsExtensions.cs | 300 ++-- .../Generated/ManagedInstancesOperations.cs | 508 ++++++- .../ManagedInstancesOperationsExtensions.cs | 250 +-- .../ManagedServerDnsAliasesOperations.cs | 1340 +++++++++++++++++ ...gedServerDnsAliasesOperationsExtensions.cs | 433 ++++++ .../src/Generated/Models/Database.cs | 13 +- .../src/Generated/Models/DatabaseIdentity.cs | 12 +- .../src/Generated/Models/DatabaseUpdate.cs | 13 +- .../src/Generated/Models/Delegation.cs | 63 - .../Generated/Models/EndpointDependency.cs | 63 + ...{UnlinkParameters.cs => EndpointDetail.cs} | 25 +- .../Generated/Models/ManagedServerDnsAlias.cs | 59 + .../ManagedServerDnsAliasAcquisition.cs | 70 + .../Models/ManagedServerDnsAliasCreation.cs | 55 + .../Models/OutboundEnvironmentEndpoint.cs | 69 + .../Models/PrivateEndpointConnection.cs | 12 +- .../PrivateEndpointConnectionProperties.cs | 12 +- .../src/Generated/Models/Server.cs | 7 +- .../src/Generated/Models/ServerUpdate.cs | 7 +- .../RecommendedSensitivityLabelsOperations.cs | 2 +- .../Generated/ReplicationLinksOperations.cs | 539 +++---- .../ReplicationLinksOperationsExtensions.cs | 252 +--- .../Generated/SdkInfo_SqlManagementClient.cs | 27 +- .../Generated/SensitivityLabelsOperations.cs | 773 +++++++--- .../SensitivityLabelsOperationsExtensions.cs | 192 ++- .../src/Generated/ServersOperations.cs | 350 ++--- .../Generated/ServersOperationsExtensions.cs | 160 +- .../src/Generated/SqlManagementClient.cs | 90 +- 37 files changed, 5523 insertions(+), 2036 deletions(-) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedServerDnsAliasesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerDnsAliasesOperationsExtensions.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Delegation.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EndpointDependency.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/{UnlinkParameters.cs => EndpointDetail.cs} (53%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAlias.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasAcquisition.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundEnvironmentEndpoint.cs 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 be59cc99b7bc..e26cac97ec6b 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/IManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs index 36420cc7522b..7a2b94ed6705 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs @@ -24,16 +24,8 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedInstancesOperations { /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The instance pool name. - /// /// /// The child resources to include in the response. /// @@ -52,10 +44,18 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The instance pool name. + /// /// /// The child resources to include in the response. /// @@ -74,7 +74,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of managed instances in a resource group. /// @@ -217,6 +217,62 @@ public partial interface IManagedInstancesOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, ManagedInstanceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Failovers a managed instance. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: + /// 'Primary', 'ReadableSecondary' + /// + /// + /// 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 FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the collection of outbound network dependencies for the given + /// managed instance. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the 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>> ListOutboundNetworkDependenciesByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Get top resource consuming queries of a managed instance. /// /// @@ -269,34 +325,6 @@ public partial interface IManagedInstancesOperations /// Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, int? numberOfQueries = default(int?), string databases = default(string), string startTime = default(string), string endTime = default(string), string interval = default(string), string aggregationFunction = default(string), string observationMetric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Failovers a managed instance. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: - /// 'Primary', 'ReadableSecondary' - /// - /// - /// 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 FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Creates or updates a managed instance. /// /// @@ -409,7 +437,7 @@ public partial interface IManagedInstancesOperations /// Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -429,9 +457,9 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// The NextLink from the previous successful call to List operation. @@ -451,7 +479,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of managed instances in a resource group. /// @@ -475,6 +503,29 @@ public partial interface IManagedInstancesOperations /// Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets the collection of outbound network dependencies for the given + /// managed instance. + /// + /// + /// 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>> ListOutboundNetworkDependenciesByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Get top resource consuming queries of a managed instance. /// /// 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 000000000000..fc03aa062c0d --- /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/IReplicationLinksOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IReplicationLinksOperations.cs index 8e46eb06c69a..f7b71ae0811b 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 ad73f817a983..9eabc21a7070 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/IServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs index af2e8ec99076..d254ca3c78a9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs @@ -24,15 +24,11 @@ namespace Microsoft.Azure.Management.Sql public partial interface IServersOperations { /// - /// Gets a list of servers in a resource groups. + /// Determines whether a resource can be created with the specified + /// 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 child resources to include in the response. + /// + /// The name availability request parameters. /// /// /// The headers that will be added to request. @@ -49,18 +45,10 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a server. + /// Gets a list of all servers in the subscription. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the server. - /// /// /// The child resources to include in the response. /// @@ -79,20 +67,17 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a server. + /// Gets a list of servers in a resource groups. /// /// /// The name of the 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 requested server resource state. + /// + /// The child resources to include in the response. /// /// /// The headers that will be added to request. @@ -109,9 +94,9 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a server. + /// Gets a server. /// /// /// The name of the resource group that contains the resource. You can @@ -121,6 +106,9 @@ public partial interface IServersOperations /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -130,12 +118,15 @@ public partial interface IServersOperations /// /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates a server. + /// Creates or updates a server. /// /// /// The name of the resource group that contains the resource. You can @@ -163,12 +154,17 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all servers in the subscription. + /// Deletes a server. /// - /// - /// The child resources to include in the response. + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the server. /// /// /// The headers that will be added to request. @@ -179,15 +175,12 @@ public partial interface IServersOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Imports a bacpac into a new database. + /// Updates a server. /// /// /// The name of the resource group that contains the resource. You can @@ -198,7 +191,7 @@ public partial interface IServersOperations /// The name of the server. /// /// - /// The database import request parameters. + /// The requested server resource state. /// /// /// The headers that will be added to request. @@ -215,13 +208,20 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Determines whether a resource can be created with the specified - /// name. + /// Imports a bacpac into a new 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 availability request parameters. + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -238,7 +238,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a server. /// @@ -354,7 +354,7 @@ public partial interface IServersOperations /// Task> BeginImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of servers in a resource groups. + /// Gets a list of all servers in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -374,9 +374,9 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all servers in the subscription. + /// Gets a list of servers in a resource groups. /// /// /// The NextLink from the previous successful call to List operation. @@ -396,6 +396,6 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(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 3b58b88bad90..6e0b25df8886 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. /// @@ -617,11 +592,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IOutboundFirewallRulesOperations OutboundFirewallRules { get; } - /// - /// Gets the IServersOperations. - /// - IServersOperations Servers { get; } - /// /// Gets the IUsagesOperations. /// @@ -637,11 +607,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } - /// - /// Gets the IManagedInstancesOperations. - /// - IManagedInstancesOperations ManagedInstances { get; } - /// /// Gets the IRestorableDroppedDatabasesOperations. /// @@ -672,5 +637,45 @@ 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 IManagedInstancesOperations. + /// + IManagedInstancesOperations ManagedInstances { get; } + + /// + /// Gets the IManagedServerDnsAliasesOperations. + /// + IManagedServerDnsAliasesOperations ManagedServerDnsAliases { get; } + + /// + /// Gets the ISensitivityLabelsOperations. + /// + ISensitivityLabelsOperations SensitivityLabels { get; } + + /// + /// Gets the IRecommendedSensitivityLabelsOperations. + /// + IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; } + + /// + /// Gets the IServersOperations. + /// + IServersOperations Servers { 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 83420a3c4ec1..6f91a482fea0 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 2ad06b5467fb..d33105436921 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 c69fc7581d30..2eb5b2e95234 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/ManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs index ab9dd81bc14e..c685d913e1c4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs @@ -51,15 +51,8 @@ internal ManagedInstancesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The instance pool name. - /// /// /// The child resources to include in the response. /// @@ -84,21 +77,13 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (instancePoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "instancePoolName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -106,18 +91,14 @@ internal ManagedInstancesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("instancePoolName", instancePoolName); tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePool", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", 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/instancePools/{instancePoolName}/managedInstances").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (expand != null) @@ -254,8 +235,15 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The instance pool name. + /// /// /// The child resources to include in the response. /// @@ -280,13 +268,21 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (instancePoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instancePoolName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -294,14 +290,18 @@ internal ManagedInstancesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("instancePoolName", instancePoolName); tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePool", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (expand != null) @@ -478,7 +478,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -679,7 +679,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -909,6 +909,229 @@ internal ManagedInstancesOperations(SqlManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Failovers a managed instance. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the 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>> ListOutboundNetworkDependenciesByManagedInstanceWithHttpMessagesAsync(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, "ListOutboundNetworkDependenciesByManagedInstance", 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}/outboundNetworkDependenciesEndpoints").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; + } + /// /// Get top resource consuming queries of a managed instance. /// @@ -979,7 +1202,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1164,33 +1387,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) return _result; } - /// - /// Failovers a managed instance. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Creates or updates a managed instance. /// @@ -1247,7 +1443,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1464,7 +1660,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1648,7 +1844,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1851,7 +2047,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-05-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1989,7 +2185,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -2015,7 +2211,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2030,7 +2226,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePoolNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2162,7 +2358,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// The NextLink from the previous successful call to List operation. @@ -2188,7 +2384,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2203,7 +2399,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePoolNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2507,6 +2703,180 @@ internal ManagedInstancesOperations(SqlManagementClient client) return _result; } + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// 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>> ListOutboundNetworkDependenciesByManagedInstanceNextWithHttpMessagesAsync(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, "ListOutboundNetworkDependenciesByManagedInstanceNext", 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; + } + /// /// Get top resource consuming queries of a managed instance. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs index 76789c27981b..f12cdc9c98a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs @@ -22,82 +22,82 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedInstancesOperationsExtensions { /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// 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 instance pool name. - /// /// /// The child resources to include in the response. /// - public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string)) + public static IPage List(this IManagedInstancesOperations operations, string expand = default(string)) { - return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expand).GetAwaiter().GetResult(); + return operations.ListAsync(expand).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// 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 instance pool name. - /// /// /// The child resources to include in the response. /// /// /// The cancellation token. /// - public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IManagedInstancesOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// 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 instance pool name. + /// /// /// The child resources to include in the response. /// - public static IPage List(this IManagedInstancesOperations operations, string expand = default(string)) + public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string)) { - return operations.ListAsync(expand).GetAwaiter().GetResult(); + return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expand).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// 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 instance pool name. + /// /// /// The child resources to include in the response. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IManagedInstancesOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -328,6 +328,97 @@ public static ManagedInstance Update(this IManagedInstancesOperations operations } } + /// + /// Failovers a managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + public static void Failover(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string replicaType = default(string)) + { + operations.FailoverAsync(resourceGroupName, managedInstanceName, replicaType).GetAwaiter().GetResult(); + } + + /// + /// Failovers a managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance to failover. + /// + /// + /// The type of replica to be failed over. Possible values include: 'Primary', + /// 'ReadableSecondary' + /// + /// + /// The cancellation token. + /// + public static async Task FailoverAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + public static IPage ListOutboundNetworkDependenciesByManagedInstance(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListOutboundNetworkDependenciesByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOutboundNetworkDependenciesByManagedInstanceAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOutboundNetworkDependenciesByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get top resource consuming queries of a managed instance. /// @@ -420,53 +511,6 @@ public static ManagedInstance Update(this IManagedInstancesOperations operations } } - /// - /// Failovers a managed instance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' - /// - public static void Failover(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string replicaType = default(string)) - { - operations.FailoverAsync(resourceGroupName, managedInstanceName, replicaType).GetAwaiter().GetResult(); - } - - /// - /// Failovers a managed instance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance to failover. - /// - /// - /// The type of replica to be failed over. Possible values include: 'Primary', - /// 'ReadableSecondary' - /// - /// - /// The cancellation token. - /// - public static async Task FailoverAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string replicaType = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Creates or updates a managed instance. /// @@ -650,7 +694,7 @@ public static ManagedInstance BeginUpdate(this IManagedInstancesOperations opera } /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -658,13 +702,13 @@ public static ManagedInstance BeginUpdate(this IManagedInstancesOperations opera /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByInstancePoolNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListByInstancePoolNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -675,16 +719,16 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc /// /// The cancellation token. /// - public static async Task> ListByInstancePoolNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// The operations group for this extension method. @@ -692,13 +736,13 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListByInstancePoolNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByInstancePoolNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. /// /// /// The operations group for this extension method. @@ -709,9 +753,9 @@ public static IPage ListNext(this IManagedInstancesOperations o /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByInstancePoolNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInstancePoolNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -751,6 +795,42 @@ public static IPage ListByResourceGroupNext(this IManagedInstan } } + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOutboundNetworkDependenciesByManagedInstanceNext(this IManagedInstancesOperations operations, string nextPageLink) + { + return operations.ListOutboundNetworkDependenciesByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the collection of outbound network dependencies for the given managed + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOutboundNetworkDependenciesByManagedInstanceNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOutboundNetworkDependenciesByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get top resource consuming queries of a managed instance. /// 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 000000000000..48534021d2f5 --- /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 000000000000..196f59d94251 --- /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 c5c3c64c7a2f..f282d44290f1 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 32e614559602..56dc6a20bea4 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 7f880478b16a..fad5a1679c9c 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 0bc3e28727ee..000000000000 --- 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/EndpointDependency.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EndpointDependency.cs new file mode 100644 index 000000000000..a643ce7b95d9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EndpointDependency.cs @@ -0,0 +1,63 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A domain name that the managed instance service needs to communicate + /// with, along with additional details. + /// + public partial class EndpointDependency + { + /// + /// Initializes a new instance of the EndpointDependency class. + /// + public EndpointDependency() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointDependency class. + /// + /// The domain name of the dependency. + /// The IP Addresses and Ports used when + /// connecting to DomainName. + public EndpointDependency(string domainName = default(string), IList endpointDetails = default(IList)) + { + DomainName = domainName; + EndpointDetails = endpointDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the domain name of the dependency. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; private set; } + + /// + /// Gets the IP Addresses and Ports used when connecting to DomainName. + /// + [JsonProperty(PropertyName = "endpointDetails")] + public IList EndpointDetails { get; private 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/EndpointDetail.cs similarity index 53% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EndpointDetail.cs index 773e905009a0..45ef7bae96ab 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UnlinkParameters.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EndpointDetail.cs @@ -14,26 +14,26 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents the parameters for Unlink Replication Link request. + /// A domain name that the managed instance service needs to communicate + /// with, along with additional details. /// - public partial class UnlinkParameters + public partial class EndpointDetail { /// - /// Initializes a new instance of the UnlinkParameters class. + /// Initializes a new instance of the EndpointDetail class. /// - public UnlinkParameters() + public EndpointDetail() { CustomInit(); } /// - /// Initializes a new instance of the UnlinkParameters class. + /// Initializes a new instance of the EndpointDetail class. /// - /// Determines whether link will be - /// terminated in a forced or a friendly way. - public UnlinkParameters(bool? forcedTermination = default(bool?)) + /// The port an endpoint is connected to. + public EndpointDetail(int? port = default(int?)) { - ForcedTermination = forcedTermination; + Port = port; CustomInit(); } @@ -43,11 +43,10 @@ public UnlinkParameters() partial void CustomInit(); /// - /// Gets or sets determines whether link will be terminated in a forced - /// or a friendly way. + /// Gets the port an endpoint is connected to. /// - [JsonProperty(PropertyName = "forcedTermination")] - public bool? ForcedTermination { get; set; } + [JsonProperty(PropertyName = "port")] + public int? Port { 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 000000000000..826cf94c2b36 --- /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 000000000000..52e9ddd88255 --- /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/ManagedServerDnsAliasCreation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs new file mode 100644 index 000000000000..77f0176e74aa --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerDnsAliasCreation.cs @@ -0,0 +1,55 @@ +// +// 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; + + /// + /// A managed server dns alias creation request. + /// + public partial class ManagedServerDnsAliasCreation + { + /// + /// Initializes a new instance of the ManagedServerDnsAliasCreation + /// class. + /// + public ManagedServerDnsAliasCreation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServerDnsAliasCreation + /// class. + /// + /// Whether or not DNS record should be + /// created for this alias. + public ManagedServerDnsAliasCreation(bool? createDnsRecord = default(bool?)) + { + CreateDnsRecord = createDnsRecord; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether or not DNS record should be created for this + /// alias. + /// + [JsonProperty(PropertyName = "createDnsRecord")] + public bool? CreateDnsRecord { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundEnvironmentEndpoint.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundEnvironmentEndpoint.cs new file mode 100644 index 000000000000..f0b061c9a212 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OutboundEnvironmentEndpoint.cs @@ -0,0 +1,69 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An endpoint that the managed instance service requires outbound network + /// access to. + /// + public partial class OutboundEnvironmentEndpoint + { + /// + /// Initializes a new instance of the OutboundEnvironmentEndpoint + /// class. + /// + public OutboundEnvironmentEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OutboundEnvironmentEndpoint + /// class. + /// + /// The type of service accessed by the managed + /// instance service, e.g., Azure Storage, Azure Active Directory, + /// etc. + /// The endpoints that the managed instance + /// service communicates with in order to function correctly. + public OutboundEnvironmentEndpoint(string category = default(string), IList endpoints = default(IList)) + { + Category = category; + Endpoints = endpoints; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of service accessed by the managed instance service, + /// e.g., Azure Storage, Azure Active Directory, etc. + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; private set; } + + /// + /// Gets the endpoints that the managed instance service communicates + /// with in order to function correctly. + /// + [JsonProperty(PropertyName = "endpoints")] + public IList Endpoints { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnection.cs index 1e5b5bd72283..f615840f7f55 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnection.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.Sql.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -42,12 +44,14 @@ public PrivateEndpointConnection() /// State of the private endpoint /// connection. Possible values include: 'Approving', 'Ready', /// 'Dropping', 'Failed', 'Rejecting' - public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) + /// Group IDs. + public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string), IList groupIds = default(IList)) : base(id, name, type) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; + GroupIds = groupIds; CustomInit(); } @@ -75,6 +79,12 @@ public PrivateEndpointConnection() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets group IDs. + /// + [JsonProperty(PropertyName = "properties.groupIds")] + public IList GroupIds { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs index 86d661659397..5308d2c2b996 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -38,11 +40,13 @@ public PrivateEndpointConnectionProperties() /// State of the private endpoint /// connection. Possible values include: 'Approving', 'Ready', /// 'Dropping', 'Failed', 'Rejecting' - public PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) + /// Group IDs. + public PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string), IList groupIds = default(IList)) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; + GroupIds = groupIds; CustomInit(); } @@ -70,6 +74,12 @@ public PrivateEndpointConnectionProperties() [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets group IDs. + /// + [JsonProperty(PropertyName = "groupIds")] + public IList GroupIds { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs index cb46c725411e..4da21ca8e728 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs @@ -68,8 +68,8 @@ public Server() /// CMK scenario /// A CMK URI of the key to use for /// encryption. - /// The Azure Active Directory identity of - /// the server. + /// The Azure Active Directory + /// administrator of the server. /// Whether or not to /// restrict outbound network access for this server. Value is /// optional but if passed in, must be 'Enabled' or 'Disabled'. @@ -195,7 +195,8 @@ public Server() public string KeyId { get; set; } /// - /// Gets or sets the Azure Active Directory identity of the server. + /// Gets or sets the Azure Active Directory administrator of the + /// server. /// [JsonProperty(PropertyName = "properties.administrators")] public ServerExternalAdministrator Administrators { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs index b5b5251a2142..612069042b21 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs @@ -60,8 +60,8 @@ public ServerUpdate() /// CMK scenario /// A CMK URI of the key to use for /// encryption. - /// The Azure Active Directory identity of - /// the server. + /// The Azure Active Directory + /// administrator of the server. /// Whether or not to /// restrict outbound network access for this server. Value is /// optional but if passed in, must be 'Enabled' or 'Disabled'. @@ -180,7 +180,8 @@ public ServerUpdate() public string KeyId { get; set; } /// - /// Gets or sets the Azure Active Directory identity of the server. + /// Gets or sets the Azure Active Directory administrator of the + /// server. /// [JsonProperty(PropertyName = "properties.administrators")] public ServerExternalAdministrator Administrators { 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 71e46e0c31ca..bd26dd99867d 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 64ddd37e63c9..2cb48749e5f3 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 5cfcc8702823..b5e56b6e2ffa 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 b8cbef4ecd7e..6966cde19a57 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 @@ -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"), @@ -96,22 +96,22 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedInstancePrivateLinkResources", "2020-11-01-preview"), new Tuple("Sql", "ManagedInstanceTdeCertificates", "2020-11-01-preview"), new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2020-11-01-preview"), - new Tuple("Sql", "ManagedInstances", "2021-05-01-preview"), + new Tuple("Sql", "ManagedInstances", "2021-11-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"), @@ -128,7 +128,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ServerTrustGroups", "2020-11-01-preview"), new Tuple("Sql", "ServerUsages", "2014-04-01"), new Tuple("Sql", "ServerVulnerabilityAssessments", "2020-11-01-preview"), - new Tuple("Sql", "Servers", "2021-02-01-preview"), + new Tuple("Sql", "Servers", "2021-11-01-preview"), new Tuple("Sql", "ServiceObjectives", "2014-04-01"), new Tuple("Sql", "SqlAgent", "2020-11-01-preview"), new Tuple("Sql", "SubscriptionUsages", "2020-11-01-preview"), @@ -146,16 +146,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - 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 c033488914ca..c3b5bb981564 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 16d206000767..bad4e1db77f4 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/ServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs index f21820645a6b..81be2f7132a0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs @@ -51,14 +51,10 @@ internal ServersOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a list of servers in a resource groups. + /// Determines whether a resource can be created with the specified 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 child resources to include in the response. + /// + /// The name availability request parameters. /// /// /// Headers that will be added to request. @@ -81,17 +77,21 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + 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-02-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -99,22 +99,16 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("expand", expand); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -126,7 +120,7 @@ internal ServersOperations(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) @@ -157,6 +151,12 @@ internal ServersOperations(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) { @@ -212,7 +212,7 @@ internal ServersOperations(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")) @@ -225,7 +225,7 @@ internal ServersOperations(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) { @@ -245,15 +245,8 @@ internal ServersOperations(SqlManagementClient client) } /// - /// Gets a server. + /// Gets a list of all servers in the subscription. /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// /// /// The child resources to include in the response. /// @@ -278,21 +271,13 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2021-02-01-preview"; + string apiVersion = "2021-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -300,18 +285,14 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", 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}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (expand != null) @@ -415,7 +396,7 @@ internal ServersOperations(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")) @@ -428,7 +409,7 @@ internal ServersOperations(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) { @@ -448,83 +429,12 @@ internal ServersOperations(SqlManagementClient client) } /// - /// Creates or updates a server. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The requested server resource state. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a server. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates a server. + /// Gets a list of servers in a resource groups. /// /// /// The name of the 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 requested server resource state. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of all servers in the subscription. - /// /// /// The child resources to include in the response. /// @@ -549,13 +459,17 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } 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; @@ -563,14 +477,16 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (expand != null) @@ -707,7 +623,7 @@ internal ServersOperations(SqlManagementClient client) } /// - /// Imports a bacpac into a new database. + /// Gets a server. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -716,27 +632,8 @@ internal ServersOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The database import request parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Determines whether a resource can be created with the specified name. - /// - /// - /// The name availability request parameters. + /// + /// The child resources to include in the response. /// /// /// Headers that will be added to request. @@ -759,21 +656,21 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (parameters == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (parameters != null) + if (serverName == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } 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; @@ -781,16 +678,24 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + 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}/providers/Microsoft.Sql/checkNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -802,7 +707,7 @@ internal ServersOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -833,12 +738,6 @@ internal ServersOperations(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) { @@ -894,7 +793,7 @@ internal ServersOperations(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")) @@ -907,7 +806,7 @@ internal ServersOperations(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) { @@ -926,6 +825,107 @@ internal ServersOperations(SqlManagementClient client) return _result; } + /// + /// Creates or updates a server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The requested server resource state. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The requested server resource state. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Imports a bacpac into a new 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 database import request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Creates or updates a server. /// @@ -982,7 +982,7 @@ internal ServersOperations(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; @@ -1199,7 +1199,7 @@ internal ServersOperations(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; @@ -1383,7 +1383,7 @@ internal ServersOperations(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; @@ -1596,7 +1596,7 @@ internal ServersOperations(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; @@ -1754,7 +1754,7 @@ internal ServersOperations(SqlManagementClient client) } /// - /// Gets a list of servers in a resource groups. + /// Gets a list of all servers in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -1780,7 +1780,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1795,7 +1795,7 @@ internal ServersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1927,7 +1927,7 @@ internal ServersOperations(SqlManagementClient client) } /// - /// Gets a list of all servers in the subscription. + /// Gets a list of servers in a resource groups. /// /// /// The NextLink from the previous successful call to List operation. @@ -1953,7 +1953,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1968,7 +1968,7 @@ internal ServersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs index c4c0511a94f4..15de72a8408e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs @@ -21,6 +21,74 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class ServersOperationsExtensions { + /// + /// Determines whether a resource can be created with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name availability request parameters. + /// + public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) + { + return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name availability request parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all servers in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// + public static IPage List(this IServersOperations operations, string expand = default(string)) + { + return operations.ListAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all servers in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServersOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of servers in a resource groups. /// @@ -246,40 +314,6 @@ public static Server Update(this IServersOperations operations, string resourceG } } - /// - /// Gets a list of all servers in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The child resources to include in the response. - /// - public static IPage List(this IServersOperations operations, string expand = default(string)) - { - return operations.ListAsync(expand).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all servers in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The child resources to include in the response. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServersOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Imports a bacpac into a new database. /// @@ -328,40 +362,6 @@ public static ImportExportOperationResult ImportDatabase(this IServersOperations } } - /// - /// Determines whether a resource can be created with the specified name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name availability request parameters. - /// - public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) - { - return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); - } - - /// - /// Determines whether a resource can be created with the specified name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name availability request parameters. - /// - /// - /// The cancellation token. - /// - public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates or updates a server. /// @@ -546,7 +546,7 @@ public static ImportExportOperationResult BeginImportDatabase(this IServersOpera } /// - /// Gets a list of servers in a resource groups. + /// Gets a list of all servers in the subscription. /// /// /// The operations group for this extension method. @@ -554,13 +554,13 @@ public static ImportExportOperationResult BeginImportDatabase(this IServersOpera /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupNext(this IServersOperations operations, string nextPageLink) + public static IPage ListNext(this IServersOperations operations, string nextPageLink) { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of servers in a resource groups. + /// Gets a list of all servers in the subscription. /// /// /// The operations group for this extension method. @@ -571,16 +571,16 @@ public static IPage ListByResourceGroupNext(this IServersOperations oper /// /// The cancellation token. /// - public static async Task> ListByResourceGroupNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of all servers in the subscription. + /// Gets a list of servers in a resource groups. /// /// /// The operations group for this extension method. @@ -588,13 +588,13 @@ public static IPage ListByResourceGroupNext(this IServersOperations oper /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IServersOperations operations, string nextPageLink) + public static IPage ListByResourceGroupNext(this IServersOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of all servers in the subscription. + /// Gets a list of servers in a resource groups. /// /// /// The operations group for this extension method. @@ -605,9 +605,9 @@ public static IPage ListNext(this IServersOperations operations, string /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(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 bcc439ccb95d..a670daad8421 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. /// @@ -622,11 +597,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IOutboundFirewallRulesOperations OutboundFirewallRules { get; private set; } - /// - /// Gets the IServersOperations. - /// - public virtual IServersOperations Servers { get; private set; } - /// /// Gets the IUsagesOperations. /// @@ -642,11 +612,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } - /// - /// Gets the IManagedInstancesOperations. - /// - public virtual IManagedInstancesOperations ManagedInstances { get; private set; } - /// /// Gets the IRestorableDroppedDatabasesOperations. /// @@ -677,6 +642,46 @@ 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 IManagedInstancesOperations. + /// + public virtual IManagedInstancesOperations ManagedInstances { 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; } + + /// + /// Gets the IServersOperations. + /// + public virtual IServersOperations Servers { 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); @@ -1028,17 +1028,23 @@ private void Initialize() DatabaseUsages = new DatabaseUsagesOperations(this); LedgerDigestUploads = new LedgerDigestUploadsOperations(this); OutboundFirewallRules = new OutboundFirewallRulesOperations(this); - Servers = new ServersOperations(this); Usages = new UsagesOperations(this); LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); - ManagedInstances = new ManagedInstancesOperations(this); RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); ServerConnectionPolicies = new ServerConnectionPoliciesOperations(this); DistributedAvailabilityGroups = new DistributedAvailabilityGroupsOperations(this); ServerTrustCertificates = new ServerTrustCertificatesOperations(this); IPv6FirewallRules = new IPv6FirewallRulesOperations(this); + ReplicationLinks = new ReplicationLinksOperations(this); + ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); + ManagedDatabaseRecommendedSensitivityLabels = new ManagedDatabaseRecommendedSensitivityLabelsOperations(this); + ManagedInstances = new ManagedInstancesOperations(this); + ManagedServerDnsAliases = new ManagedServerDnsAliasesOperations(this); + SensitivityLabels = new SensitivityLabelsOperations(this); + RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); + Servers = new ServersOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30;