diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs index 4c10ea314e72..c127e57aeb8a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs @@ -544,7 +544,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -746,7 +746,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1034,7 +1034,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1313,7 +1313,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1549,7 +1549,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1975,7 +1975,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2201,7 +2201,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2394,7 +2394,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2605,7 +2605,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2809,7 +2809,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3014,7 +3014,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3202,7 +3202,7 @@ internal DatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionBackupsOperations.cs index 8a567523d58e..87eada5fc9bc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionBackupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionBackupsOperations.cs @@ -24,13 +24,42 @@ namespace Microsoft.Azure.Management.Sql public partial interface ILongTermRetentionBackupsOperations { /// - /// Gets a long term retention backup. + /// Copy an existing long term retention backup. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// 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> CopyWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing long term retention backup. + /// /// /// The location of the database. /// @@ -43,6 +72,9 @@ public partial interface ILongTermRetentionBackupsOperations /// /// The backup name. /// + /// + /// The requested backup resource state + /// /// /// The headers that will be added to request. /// @@ -58,15 +90,41 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task> GetByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a long term retention backup. + /// Gets a long term retention backup. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// + /// The location of the database. /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// 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 locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a long term retention backup. + /// /// /// The location of the database /// @@ -91,15 +149,10 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task DeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all long term retention backups for a database. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// /// /// The location of the database /// @@ -132,15 +185,10 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupDatabaseWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given location. /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// /// /// The location of the database /// @@ -167,15 +215,10 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupLocationWithHttpMessagesAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByLocationWithHttpMessagesAsync(string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given 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 location of the database /// @@ -205,10 +248,93 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupServerWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Copy an existing long term retention backup to a different 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// 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> CopyByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing long term retention backup. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// 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> UpdateByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a long term retention backup. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// /// /// The location of the database. /// @@ -236,10 +362,15 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a long term retention backup. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// /// /// The location of the database /// @@ -264,10 +395,15 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all long term retention backups for a database. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// /// /// The location of the database /// @@ -300,10 +436,15 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupDatabaseWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given location. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// /// /// The location of the database /// @@ -330,10 +471,15 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByLocationWithHttpMessagesAsync(string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupLocationWithHttpMessagesAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given 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 location of the database /// @@ -363,17 +509,113 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupServerWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Copy an existing long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// 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> BeginCopyWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a long term retention backup. /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// 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 locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Copy an existing long term retention backup to a different 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 location of the database + /// The location of the database. /// /// /// The name of the server @@ -384,6 +626,9 @@ public partial interface ILongTermRetentionBackupsOperations /// /// The backup name. /// + /// + /// The parameters needed for long term retention copy request + /// /// /// The headers that will be added to request. /// @@ -393,13 +638,60 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCopyByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing long term retention backup. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// 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> BeginUpdateByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a long term retention backup. /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// /// /// The location of the database /// @@ -424,7 +716,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all long term retention backups for a database. /// @@ -446,7 +738,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given location. /// @@ -468,7 +760,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given server. /// @@ -490,7 +782,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all long term retention backups for a database. /// @@ -512,7 +804,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given location. /// @@ -534,7 +826,7 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the long term retention backups for a given server. /// @@ -556,6 +848,6 @@ public partial interface ILongTermRetentionBackupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IBackupLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionPoliciesOperations.cs similarity index 70% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IBackupLongTermRetentionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionPoliciesOperations.cs index 71f5dd104add..714cf6b811ee 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IBackupLongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ILongTermRetentionPoliciesOperations.cs @@ -19,9 +19,9 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// BackupLongTermRetentionPoliciesOperations operations. + /// LongTermRetentionPoliciesOperations operations. /// - public partial interface IBackupLongTermRetentionPoliciesOperations + public partial interface ILongTermRetentionPoliciesOperations { /// /// Gets a database's long term retention policy. @@ -52,7 +52,7 @@ public partial interface IBackupLongTermRetentionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Sets a database's long term retention policy. /// @@ -85,7 +85,7 @@ public partial interface IBackupLongTermRetentionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a database's long term retention policy. /// @@ -115,7 +115,7 @@ public partial interface IBackupLongTermRetentionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Sets a database's long term retention policy. /// @@ -148,6 +148,28 @@ public partial interface IBackupLongTermRetentionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a database's long term retention policy. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs index 4696e739b40a..0f57e4aa7fe3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -292,16 +292,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IJobVersionsOperations JobVersions { get; } - /// - /// Gets the ILongTermRetentionBackupsOperations. - /// - ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } - - /// - /// Gets the IBackupLongTermRetentionPoliciesOperations. - /// - IBackupLongTermRetentionPoliciesOperations BackupLongTermRetentionPolicies { get; } - /// /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// @@ -447,11 +437,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IUsagesOperations Usages { get; } - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } - /// /// Gets the IPrivateLinkResourcesOperations. /// @@ -547,5 +532,20 @@ public partial interface ISqlManagementClient : System.IDisposable /// IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; } + /// + /// Gets the ILongTermRetentionBackupsOperations. + /// + ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } + + /// + /// Gets the ILongTermRetentionPoliciesOperations. + /// + ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs index d96ccd6e161b..37c396a655b1 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperations.cs @@ -50,6 +50,1011 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } + /// + /// Copy an existing long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CopyWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCopyWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// 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 locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (longTermRetentionServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionServerName"); + } + if (longTermRetentionDatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionDatabaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); + tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); + tracingParameters.Add("backupName", backupName); + 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}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); + _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); + _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; + } + + /// + /// Deletes a long term retention backup. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all long term retention backups for a database. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// 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>> ListByDatabaseWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (longTermRetentionServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionServerName"); + } + if (longTermRetentionDatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionDatabaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); + tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); + _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (onlyLatestPerDatabase != null) + { + _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); + } + if (databaseState != null) + { + _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); + } + 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; + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// The location of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (onlyLatestPerDatabase != null) + { + _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); + } + if (databaseState != null) + { + _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); + } + 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; + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// 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>> ListByServerWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (longTermRetentionServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (onlyLatestPerDatabase != null) + { + _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); + } + if (databaseState != null) + { + _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); + } + 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; + } + + /// + /// Copy an existing long term retention backup to a different 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CopyByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCopyByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Gets a long term retention backup. /// @@ -116,7 +1121,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -370,7 +1375,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -586,7 +1591,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -805,7 +1810,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -968,7 +1973,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) } /// - /// Gets a long term retention backup. + /// Copy an existing long term retention backup. /// /// /// The location of the database. @@ -982,6 +1987,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// The backup name. /// + /// + /// The parameters needed for long term retention copy request + /// /// /// Headers that will be added to request. /// @@ -1003,7 +2011,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCopyWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (locationName == null) { @@ -1021,11 +2029,15 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1037,13 +2049,14 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCopy", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy").ToString(); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); @@ -1061,7 +2074,7 @@ internal LongTermRetentionBackupsOperations(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) @@ -1092,6 +2105,12 @@ internal LongTermRetentionBackupsOperations(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) { @@ -1112,7 +2131,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1147,7 +2166,7 @@ internal LongTermRetentionBackupsOperations(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")) @@ -1160,58 +2179,30 @@ internal LongTermRetentionBackupsOperations(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) { - _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 a long term retention backup. - /// - /// - /// The location of the database - /// - /// - /// The name of the server - /// - /// - /// The name of the database - /// - /// - /// The backup name. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + _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; } /// - /// Lists all long term retention backups for a database. + /// Updates an existing long term retention backup. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -1219,12 +2210,11 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// The name of the database /// - /// - /// Whether or not to only get the latest backup for each database. + /// + /// The backup name. /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The requested backup resource state /// /// /// Headers that will be added to request. @@ -1247,7 +2237,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (locationName == null) { @@ -1261,11 +2251,19 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionDatabaseName"); } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1276,28 +2274,21 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("locationName", locationName); tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); - tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); - tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update").ToString(); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (onlyLatestPerDatabase != null) - { - _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); - } - if (databaseState != null) - { - _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1309,7 +2300,7 @@ internal LongTermRetentionBackupsOperations(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,6 +2331,12 @@ internal LongTermRetentionBackupsOperations(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) { @@ -1360,7 +2357,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1395,7 +2392,7 @@ internal LongTermRetentionBackupsOperations(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")) @@ -1408,7 +2405,7 @@ internal LongTermRetentionBackupsOperations(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) { @@ -1428,17 +2425,19 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) } /// - /// Lists the long term retention backups for a given location. + /// Deletes a long term retention backup. /// /// /// The location of the database /// - /// - /// Whether or not to only get the latest backup for each database. + /// + /// The name of the server /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The name of the database + /// + /// + /// The backup name. /// /// /// Headers that will be added to request. @@ -1449,9 +2448,6 @@ internal LongTermRetentionBackupsOperations(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 /// @@ -1461,17 +2457,29 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (locationName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); } + if (longTermRetentionServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionServerName"); + } + if (longTermRetentionDatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionDatabaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1480,26 +2488,22 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); - tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); + tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); + tracingParameters.Add("backupName", backupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + 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}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); + _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (onlyLatestPerDatabase != null) - { - _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); - } - if (databaseState != null) - { - _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1511,7 +2515,7 @@ internal LongTermRetentionBackupsOperations(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) @@ -1562,7 +2566,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1597,31 +2601,13 @@ internal LongTermRetentionBackupsOperations(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); @@ -1630,20 +2616,26 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) } /// - /// Lists the long term retention backups for a given server. + /// Copy an existing long term retention backup to a different 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 location of the database + /// The location of the database. /// /// /// The name of the server /// - /// - /// Whether or not to only get the latest backup for each database. + /// + /// The name of the database /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request /// /// /// Headers that will be added to request. @@ -1666,8 +2658,12 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCopyByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } if (locationName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); @@ -1676,11 +2672,23 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionServerName"); } + if (longTermRetentionDatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "longTermRetentionDatabaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1688,29 +2696,26 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); - tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); - tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCopyByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); + _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (onlyLatestPerDatabase != null) - { - _queryParameters.Add(string.Format("onlyLatestPerDatabase={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(onlyLatestPerDatabase, Client.SerializationSettings).Trim('"')))); - } - if (databaseState != null) - { - _queryParameters.Add(string.Format("databaseState={0}", System.Uri.EscapeDataString(databaseState))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1722,7 +2727,7 @@ internal LongTermRetentionBackupsOperations(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) @@ -1753,6 +2758,12 @@ internal LongTermRetentionBackupsOperations(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) { @@ -1773,7 +2784,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1808,7 +2819,7 @@ internal LongTermRetentionBackupsOperations(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")) @@ -1821,7 +2832,7 @@ internal LongTermRetentionBackupsOperations(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) { @@ -1841,14 +2852,14 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) } /// - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// /// /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -1859,6 +2870,9 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// The backup name. /// + /// + /// The requested backup resource state + /// /// /// Headers that will be added to request. /// @@ -1868,6 +2882,9 @@ internal LongTermRetentionBackupsOperations(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 /// @@ -1877,7 +2894,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1899,11 +2916,15 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1916,13 +2937,14 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteByResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateByResourceGroup", 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/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); @@ -1941,7 +2963,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1972,6 +2994,12 @@ internal LongTermRetentionBackupsOperations(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) { @@ -2027,13 +3055,31 @@ internal LongTermRetentionBackupsOperations(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); @@ -2044,6 +3090,10 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// Deletes a long term retention backup. /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// /// /// The location of the database /// @@ -2074,8 +3124,12 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } if (locationName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); @@ -2096,7 +3150,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2104,17 +3158,19 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("locationName", locationName); tracingParameters.Add("longTermRetentionServerName", longTermRetentionServerName); tracingParameters.Add("longTermRetentionDatabaseName", longTermRetentionDatabaseName); tracingParameters.Add("backupName", backupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); _url = _url.Replace("{longTermRetentionServerName}", System.Uri.EscapeDataString(longTermRetentionServerName)); _url = _url.Replace("{longTermRetentionDatabaseName}", System.Uri.EscapeDataString(longTermRetentionDatabaseName)); @@ -2259,7 +3315,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(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) { @@ -2274,7 +3330,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2432,7 +3488,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2447,7 +3503,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupLocationNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2605,7 +3661,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2620,7 +3676,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupServerNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2778,7 +3834,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2793,7 +3849,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupDatabaseNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2951,7 +4007,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2966,7 +4022,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupLocationNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3124,7 +4180,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3139,7 +4195,7 @@ internal LongTermRetentionBackupsOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupServerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperationsExtensions.cs index 5e6f4a0dda2b..2cd514b86c70 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionBackupsOperationsExtensions.cs @@ -21,6 +21,517 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class LongTermRetentionBackupsOperationsExtensions { + /// + /// Copy an existing long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + public static LongTermRetentionBackupOperationResult Copy(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) + { + return operations.CopyAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Copy an existing long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// The cancellation token. + /// + public static async Task CopyAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CopyWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + public static LongTermRetentionBackupOperationResult Update(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) + { + return operations.UpdateAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + public static LongTermRetentionBackup Get(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + { + return operations.GetAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + public static void Delete(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + { + operations.DeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a long term retention backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all long term retention backups for a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + public static IPage ListByDatabase(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists all long term retention backups for a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + public static IPage ListByLocation(this ILongTermRetentionBackupsOperations operations, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByLocationAsync(locationName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this ILongTermRetentionBackupsOperations operations, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + public static IPage ListByServer(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the server + /// + /// + /// Whether or not to only get the latest backup for each database. + /// + /// + /// Whether to query against just live databases, just deleted databases, or + /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Copy an existing long term retention backup to a different 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + public static LongTermRetentionBackupOperationResult CopyByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) + { + return operations.CopyByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Copy an existing long term retention backup to a different 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request + /// + /// + /// The cancellation token. + /// + public static async Task CopyByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CopyByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + public static LongTermRetentionBackupOperationResult UpdateByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) + { + return operations.UpdateByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing long term retention backup. + /// + /// + /// 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 location of the database. + /// + /// + /// The name of the server + /// + /// + /// The name of the database + /// + /// + /// The backup name. + /// + /// + /// The requested backup resource state + /// + /// + /// The cancellation token. + /// + public static async Task UpdateByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a long term retention backup. /// @@ -325,7 +836,7 @@ public static void DeleteByResourceGroup(this ILongTermRetentionBackupsOperation } /// - /// Gets a long term retention backup. + /// Copy an existing long term retention backup. /// /// /// The operations group for this extension method. @@ -342,13 +853,16 @@ public static void DeleteByResourceGroup(this ILongTermRetentionBackupsOperation /// /// The backup name. /// - public static LongTermRetentionBackup Get(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + /// + /// The parameters needed for long term retention copy request + /// + public static LongTermRetentionBackupOperationResult BeginCopy(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) { - return operations.GetAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + return operations.BeginCopyAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); } /// - /// Gets a long term retention backup. + /// Copy an existing long term retention backup. /// /// /// The operations group for this extension method. @@ -365,25 +879,28 @@ public static LongTermRetentionBackup Get(this ILongTermRetentionBackupsOperatio /// /// The backup name. /// + /// + /// The parameters needed for long term retention copy request + /// /// /// The cancellation token. /// - public static async Task GetAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCopyAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCopyWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// /// /// The operations group for this extension method. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -394,19 +911,22 @@ public static LongTermRetentionBackup Get(this ILongTermRetentionBackupsOperatio /// /// The backup name. /// - public static void Delete(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + /// + /// The requested backup resource state + /// + public static LongTermRetentionBackupOperationResult BeginUpdate(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) { - operations.DeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); } /// - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// /// /// The operations group for this extension method. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -417,16 +937,22 @@ public static void Delete(this ILongTermRetentionBackupsOperations operations, s /// /// The backup name. /// + /// + /// The requested backup resource state + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Lists all long term retention backups for a database. + /// Deletes a long term retention backup. /// /// /// The operations group for this extension method. @@ -440,20 +966,16 @@ public static void Delete(this ILongTermRetentionBackupsOperations operations, s /// /// The name of the database /// - /// - /// Whether or not to only get the latest backup for each database. - /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The backup name. /// - public static IPage ListByDatabase(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + public static void BeginDelete(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { - return operations.ListByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); } /// - /// Lists all long term retention backups for a database. + /// Deletes a long term retention backup. /// /// /// The operations group for this extension method. @@ -467,128 +989,85 @@ public static void Delete(this ILongTermRetentionBackupsOperations operations, s /// /// The name of the database /// - /// - /// Whether or not to only get the latest backup for each database. - /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The backup name. /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The location of the database - /// - /// - /// Whether or not to only get the latest backup for each database. - /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' - /// - public static IPage ListByLocation(this ILongTermRetentionBackupsOperations operations, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + public static async Task BeginDeleteAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.ListByLocationAsync(locationName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + (await operations.BeginDeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Lists the long term retention backups for a given location. + /// Copy an existing long term retention backup to a different server. /// /// /// The operations group for this extension method. /// - /// - /// The location of the database - /// - /// - /// Whether or not to only get the latest backup for each database. - /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' - /// - /// - /// The cancellation token. - /// - public static async Task> ListByLocationAsync(this ILongTermRetentionBackupsOperations operations, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the long term retention backups for a given 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 location of the database + /// The location of the database. /// /// /// The name of the server /// - /// - /// Whether or not to only get the latest backup for each database. + /// + /// The name of the database /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The backup name. /// - public static IPage ListByServer(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + /// + /// The parameters needed for long term retention copy request + /// + public static LongTermRetentionBackupOperationResult BeginCopyByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) { - return operations.ListByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + return operations.BeginCopyByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); } /// - /// Lists the long term retention backups for a given server. + /// Copy an existing long term retention backup to a different 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 location of the database + /// The location of the database. /// /// /// The name of the server /// - /// - /// Whether or not to only get the latest backup for each database. + /// + /// The name of the database /// - /// - /// Whether to query against just live databases, just deleted databases, or - /// all databases. Possible values include: 'All', 'Live', 'Deleted' + /// + /// The backup name. + /// + /// + /// The parameters needed for long term retention copy request /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCopyByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCopyByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// /// /// The operations group for this extension method. @@ -598,7 +1077,7 @@ public static void Delete(this ILongTermRetentionBackupsOperations operations, s /// this value from the Azure Resource Manager API or the portal. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -609,13 +1088,16 @@ public static void Delete(this ILongTermRetentionBackupsOperations operations, s /// /// The backup name. /// - public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + /// + /// The requested backup resource state + /// + public static LongTermRetentionBackupOperationResult BeginUpdateByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) { - operations.BeginDeleteByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + return operations.BeginUpdateByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).GetAwaiter().GetResult(); } /// - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// /// /// The operations group for this extension method. @@ -625,7 +1107,7 @@ public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOper /// this value from the Azure Resource Manager API or the portal. /// /// - /// The location of the database + /// The location of the database. /// /// /// The name of the server @@ -636,12 +1118,18 @@ public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOper /// /// The backup name. /// + /// + /// The requested backup resource state + /// /// /// The cancellation token. /// - public static async Task BeginDeleteByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginUpdateByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -650,6 +1138,10 @@ public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOper /// /// 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 location of the database /// @@ -662,9 +1154,9 @@ public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOper /// /// The backup name. /// - public static void BeginDelete(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + public static void BeginDeleteByResourceGroup(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { - operations.BeginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); + operations.BeginDeleteByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).GetAwaiter().GetResult(); } /// @@ -673,6 +1165,10 @@ public static void BeginDelete(this ILongTermRetentionBackupsOperations operatio /// /// 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 location of the database /// @@ -688,9 +1184,9 @@ public static void BeginDelete(this ILongTermRetentionBackupsOperations operatio /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this ILongTermRetentionBackupsOperations operations, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteByResourceGroupAsync(this ILongTermRetentionBackupsOperations operations, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -702,9 +1198,9 @@ public static void BeginDelete(this ILongTermRetentionBackupsOperations operatio /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupDatabaseNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByDatabaseNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByResourceGroupDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -719,9 +1215,9 @@ public static IPage ListByResourceGroupDatabaseNext(thi /// /// The cancellation token. /// - public static async Task> ListByResourceGroupDatabaseNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -736,9 +1232,9 @@ public static IPage ListByResourceGroupDatabaseNext(thi /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupLocationNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByLocationNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByResourceGroupLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -753,9 +1249,9 @@ public static IPage ListByResourceGroupLocationNext(thi /// /// The cancellation token. /// - public static async Task> ListByResourceGroupLocationNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByLocationNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -770,9 +1266,9 @@ public static IPage ListByResourceGroupLocationNext(thi /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupServerNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByServerNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByResourceGroupServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -787,9 +1283,9 @@ public static IPage ListByResourceGroupServerNext(this /// /// The cancellation token. /// - public static async Task> ListByResourceGroupServerNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -804,9 +1300,9 @@ public static IPage ListByResourceGroupServerNext(this /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByDatabaseNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByResourceGroupDatabaseNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -821,9 +1317,9 @@ public static IPage ListByDatabaseNext(this ILongTermRe /// /// The cancellation token. /// - public static async Task> ListByDatabaseNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupDatabaseNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -838,9 +1334,9 @@ public static IPage ListByDatabaseNext(this ILongTermRe /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByLocationNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByResourceGroupLocationNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -855,9 +1351,9 @@ public static IPage ListByLocationNext(this ILongTermRe /// /// The cancellation token. /// - public static async Task> ListByLocationNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupLocationNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -872,9 +1368,9 @@ public static IPage ListByLocationNext(this ILongTermRe /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByServerNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) + public static IPage ListByResourceGroupServerNext(this ILongTermRetentionBackupsOperations operations, string nextPageLink) { - return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupServerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -889,9 +1385,9 @@ public static IPage ListByServerNext(this ILongTermRete /// /// The cancellation token. /// - public static async Task> ListByServerNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupServerNextAsync(this ILongTermRetentionBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs similarity index 75% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs index eca2c75d6df4..4d8895d6fa49 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// BackupLongTermRetentionPoliciesOperations operations. + /// LongTermRetentionPoliciesOperations operations. /// - internal partial class BackupLongTermRetentionPoliciesOperations : IServiceOperations, IBackupLongTermRetentionPoliciesOperations + internal partial class LongTermRetentionPoliciesOperations : IServiceOperations, ILongTermRetentionPoliciesOperations { /// - /// Initializes a new instance of the BackupLongTermRetentionPoliciesOperations class. + /// Initializes a new instance of the LongTermRetentionPoliciesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class BackupLongTermRetentionPoliciesOperations : IServiceOpera /// /// Thrown when a required parameter is null /// - internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) + internal LongTermRetentionPoliciesOperations(SqlManagementClient client) { if (client == null) { @@ -84,7 +84,7 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -103,7 +103,7 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -225,7 +225,7 @@ internal BackupLongTermRetentionPoliciesOperations(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")) @@ -238,7 +238,7 @@ internal BackupLongTermRetentionPoliciesOperations(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) { @@ -279,10 +279,10 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -320,7 +320,7 @@ internal BackupLongTermRetentionPoliciesOperations(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>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -338,7 +338,7 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -458,7 +458,7 @@ internal BackupLongTermRetentionPoliciesOperations(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")) @@ -471,7 +471,7 @@ internal BackupLongTermRetentionPoliciesOperations(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) { @@ -527,7 +527,7 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -550,7 +550,7 @@ internal BackupLongTermRetentionPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -679,7 +679,7 @@ internal BackupLongTermRetentionPoliciesOperations(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")) @@ -692,7 +692,180 @@ internal BackupLongTermRetentionPoliciesOperations(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) + { + _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 database's long term retention policy. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _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) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperationsExtensions.cs similarity index 70% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperationsExtensions.cs index 0459f0161871..06e682f3fe80 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupLongTermRetentionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionPoliciesOperationsExtensions.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for BackupLongTermRetentionPoliciesOperations. + /// Extension methods for LongTermRetentionPoliciesOperations. /// - public static partial class BackupLongTermRetentionPoliciesOperationsExtensions + public static partial class LongTermRetentionPoliciesOperationsExtensions { /// /// Gets a database's long term retention policy. @@ -37,7 +37,7 @@ public static partial class BackupLongTermRetentionPoliciesOperationsExtensions /// /// The name of the database. /// - public static BackupLongTermRetentionPolicy Get(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static LongTermRetentionPolicy Get(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } @@ -61,7 +61,7 @@ public static BackupLongTermRetentionPolicy Get(this IBackupLongTermRetentionPol /// /// The cancellation token. /// - public static async Task GetAsync(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -88,7 +88,7 @@ public static BackupLongTermRetentionPolicy Get(this IBackupLongTermRetentionPol /// /// The long term retention policy info. /// - public static BackupLongTermRetentionPolicy CreateOrUpdate(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters) + public static LongTermRetentionPolicy CreateOrUpdate(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters) { return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } @@ -115,7 +115,7 @@ public static BackupLongTermRetentionPolicy CreateOrUpdate(this IBackupLongTermR /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -139,7 +139,7 @@ public static BackupLongTermRetentionPolicy CreateOrUpdate(this IBackupLongTermR /// /// The name of the database. /// - public static BackupLongTermRetentionPolicy ListByDatabase(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } @@ -163,7 +163,7 @@ public static BackupLongTermRetentionPolicy ListByDatabase(this IBackupLongTermR /// /// The cancellation token. /// - public static async Task ListByDatabaseAsync(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -190,7 +190,7 @@ public static BackupLongTermRetentionPolicy ListByDatabase(this IBackupLongTermR /// /// The long term retention policy info. /// - public static BackupLongTermRetentionPolicy BeginCreateOrUpdate(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters) + public static LongTermRetentionPolicy BeginCreateOrUpdate(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } @@ -217,7 +217,7 @@ public static BackupLongTermRetentionPolicy BeginCreateOrUpdate(this IBackupLong /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IBackupLongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this ILongTermRetentionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -225,5 +225,39 @@ public static BackupLongTermRetentionPolicy BeginCreateOrUpdate(this IBackupLong } } + /// + /// Gets a database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ILongTermRetentionPoliciesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// 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 ILongTermRetentionPoliciesOperations 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/Models/DatabaseState2.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupStorageRedundancy.cs similarity index 66% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState2.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupStorageRedundancy.cs index fc0c0446db5e..65c4e42a7406 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState2.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupStorageRedundancy.cs @@ -12,12 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for DatabaseState2. + /// Defines values for BackupStorageRedundancy. /// - public static class DatabaseState2 + public static class BackupStorageRedundancy { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; + public const string Geo = "Geo"; + public const string Local = "Local"; + public const string Zone = "Zone"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs new file mode 100644 index 000000000000..76e1849789c0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs @@ -0,0 +1,106 @@ +// +// 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; + + /// + /// Contains the information necessary to perform long term retention + /// backup copy operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class CopyLongTermRetentionBackupParameters + { + /// + /// Initializes a new instance of the + /// CopyLongTermRetentionBackupParameters class. + /// + public CopyLongTermRetentionBackupParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CopyLongTermRetentionBackupParameters class. + /// + /// The subscription that owns the + /// target server + /// The resource group that owns the + /// target server + /// The resource Id of the target + /// server that owns the database + /// The fully + /// qualified domain name of the target server + /// The name of the database owns the + /// copied backup. + /// The storage redundancy + /// type of the copied backup. Possible values include: 'Geo', 'Local', + /// 'Zone' + public CopyLongTermRetentionBackupParameters(string targetSubscriptionId = default(string), string targetResourceGroup = default(string), string targetServerResourceId = default(string), string targetServerFullyQualifiedDomainName = default(string), string targetDatabaseName = default(string), string targetBackupStorageRedundancy = default(string)) + { + TargetSubscriptionId = targetSubscriptionId; + TargetResourceGroup = targetResourceGroup; + TargetServerResourceId = targetServerResourceId; + TargetServerFullyQualifiedDomainName = targetServerFullyQualifiedDomainName; + TargetDatabaseName = targetDatabaseName; + TargetBackupStorageRedundancy = targetBackupStorageRedundancy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subscription that owns the target server + /// + [JsonProperty(PropertyName = "properties.targetSubscriptionId")] + public string TargetSubscriptionId { get; set; } + + /// + /// Gets or sets the resource group that owns the target server + /// + [JsonProperty(PropertyName = "properties.targetResourceGroup")] + public string TargetResourceGroup { get; set; } + + /// + /// Gets or sets the resource Id of the target server that owns the + /// database + /// + [JsonProperty(PropertyName = "properties.targetServerResourceId")] + public string TargetServerResourceId { get; set; } + + /// + /// Gets or sets the fully qualified domain name of the target server + /// + [JsonProperty(PropertyName = "properties.targetServerFullyQualifiedDomainName")] + public string TargetServerFullyQualifiedDomainName { get; set; } + + /// + /// Gets or sets the name of the database owns the copied backup. + /// + [JsonProperty(PropertyName = "properties.targetDatabaseName")] + public string TargetDatabaseName { get; set; } + + /// + /// Gets or sets the storage redundancy type of the copied backup. + /// Possible values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.targetBackupStorageRedundancy")] + public string TargetBackupStorageRedundancy { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState4.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs similarity index 65% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState4.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs index 47eff0771e7d..446a823940c5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState4.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/CurrentBackupStorageRedundancy.cs @@ -12,12 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for DatabaseState4. + /// Defines values for CurrentBackupStorageRedundancy. /// - public static class DatabaseState4 + public static class CurrentBackupStorageRedundancy { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; + public const string Geo = "Geo"; + public const string Local = "Local"; + public const string Zone = "Zone"; } } 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 b5e211bd6c3b..9eb5276845e3 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 @@ -176,9 +176,12 @@ public Database() /// Time in minutes after which database /// is automatically paused. A value of -1 means that automatic pause /// is disabled - /// The storage account type used to - /// store backups for this database. Possible values include: 'GRS', - /// 'LRS', 'ZRS' + /// The storage account + /// type used to store backups for this database. Possible values + /// include: 'Geo', 'Local', 'Zone' + /// The storage account + /// type to be used to store backups for this database. Possible values + /// include: 'Geo', 'Local', 'Zone' /// Minimal capacity that database will /// always have allocated, if not paused /// The date when database was paused by user @@ -190,7 +193,7 @@ public Database() /// Maintenance configuration /// id assigned to the database. This configuration defines the period /// when the maintenance updates will occur. - 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), 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 storageAccountType = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = 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), 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)) : base(location, id, name, type, tags) { Sku = sku; @@ -225,7 +228,8 @@ public Database() SecondaryType = secondaryType; CurrentSku = currentSku; AutoPauseDelay = autoPauseDelay; - StorageAccountType = storageAccountType; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; MinCapacity = minCapacity; PausedDate = pausedDate; ResumedDate = resumedDate; @@ -516,11 +520,18 @@ public Database() public int? AutoPauseDelay { get; set; } /// - /// Gets or sets the storage account type used to store backups for - /// this database. Possible values include: 'GRS', 'LRS', 'ZRS' + /// Gets the storage account type used to store backups for this + /// database. Possible values include: 'Geo', 'Local', 'Zone' /// - [JsonProperty(PropertyName = "properties.storageAccountType")] - public string StorageAccountType { get; set; } + [JsonProperty(PropertyName = "properties.currentBackupStorageRedundancy")] + public string CurrentBackupStorageRedundancy { get; private set; } + + /// + /// Gets or sets the storage account type to be used to store backups + /// for this database. Possible values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.requestedBackupStorageRedundancy")] + public string RequestedBackupStorageRedundancy { get; set; } /// /// Gets or sets minimal capacity that database will always have diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState1.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState.cs similarity index 87% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState1.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState.cs index 2692f1d2ec2c..e0db5559a05c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState1.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for DatabaseState1. + /// Defines values for DatabaseState. /// - public static class DatabaseState1 + public static class DatabaseState { public const string All = "All"; public const string Live = "Live"; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState5.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState5.cs deleted file mode 100644 index ce9a5903a777..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState5.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for DatabaseState5. - /// - public static class DatabaseState5 - { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState6.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState6.cs deleted file mode 100644 index dc5e76219007..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState6.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for DatabaseState6. - /// - public static class DatabaseState6 - { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; - } -} 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 2b47cee16a80..025dc1ccc6b3 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 @@ -153,9 +153,12 @@ public DatabaseUpdate() /// Time in minutes after which database /// is automatically paused. A value of -1 means that automatic pause /// is disabled - /// The storage account type used to - /// store backups for this database. Possible values include: 'GRS', - /// 'LRS', 'ZRS' + /// The storage account + /// type used to store backups for this database. Possible values + /// include: 'Geo', 'Local', 'Zone' + /// The storage account + /// type to be used to store backups for this database. Possible values + /// include: 'Geo', 'Local', 'Zone' /// Minimal capacity that database will /// always have allocated, if not paused /// The date when database was paused by user @@ -168,7 +171,7 @@ public DatabaseUpdate() /// id assigned to the database. This configuration defines the period /// when the maintenance updates will occur. /// Resource tags. - public DatabaseUpdate(Sku sku = default(Sku), 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 storageAccountType = default(string), double? minCapacity = default(double?), System.DateTime? pausedDate = default(System.DateTime?), System.DateTime? resumedDate = default(System.DateTime?), string maintenanceConfigurationId = default(string), IDictionary tags = default(IDictionary)) + public DatabaseUpdate(Sku sku = default(Sku), 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), IDictionary tags = default(IDictionary)) { Sku = sku; CreateMode = createMode; @@ -200,7 +203,8 @@ public DatabaseUpdate() SecondaryType = secondaryType; CurrentSku = currentSku; AutoPauseDelay = autoPauseDelay; - StorageAccountType = storageAccountType; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; MinCapacity = minCapacity; PausedDate = pausedDate; ResumedDate = resumedDate; @@ -464,11 +468,18 @@ public DatabaseUpdate() public int? AutoPauseDelay { get; set; } /// - /// Gets or sets the storage account type used to store backups for - /// this database. Possible values include: 'GRS', 'LRS', 'ZRS' + /// Gets the storage account type used to store backups for this + /// database. Possible values include: 'Geo', 'Local', 'Zone' /// - [JsonProperty(PropertyName = "properties.storageAccountType")] - public string StorageAccountType { get; set; } + [JsonProperty(PropertyName = "properties.currentBackupStorageRedundancy")] + public string CurrentBackupStorageRedundancy { get; private set; } + + /// + /// Gets or sets the storage account type to be used to store backups + /// for this database. Possible values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.requestedBackupStorageRedundancy")] + public string RequestedBackupStorageRedundancy { get; set; } /// /// Gets or sets minimal capacity that database will always have diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackup.cs index 9c2decc93b6d..7334f397c608 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackup.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackup.cs @@ -46,7 +46,13 @@ public LongTermRetentionBackup() /// The time the backup was taken /// The time the long term retention /// backup will expire. - public LongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string serverName = default(string), System.DateTime? serverCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?)) + /// The storage redundancy type + /// of the backup. Possible values include: 'Geo', 'Local', + /// 'Zone' + /// The storage + /// redundancy type of the backup. Possible values include: 'Geo', + /// 'Local', 'Zone' + public LongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string serverName = default(string), System.DateTime? serverCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?), string backupStorageRedundancy = default(string), string requestedBackupStorageRedundancy = default(string)) : base(id, name, type) { ServerName = serverName; @@ -55,6 +61,8 @@ public LongTermRetentionBackup() DatabaseDeletionTime = databaseDeletionTime; BackupTime = backupTime; BackupExpirationTime = backupExpirationTime; + BackupStorageRedundancy = backupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; CustomInit(); } @@ -99,5 +107,19 @@ public LongTermRetentionBackup() [JsonProperty(PropertyName = "properties.backupExpirationTime")] public System.DateTime? BackupExpirationTime { get; private set; } + /// + /// Gets the storage redundancy type of the backup. Possible values + /// include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.backupStorageRedundancy")] + public string BackupStorageRedundancy { get; private set; } + + /// + /// Gets or sets the storage redundancy type of the backup. Possible + /// values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.requestedBackupStorageRedundancy")] + public string RequestedBackupStorageRedundancy { get; set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs new file mode 100644 index 000000000000..af6b35a93dd0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs @@ -0,0 +1,112 @@ +// +// 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 LongTermRetentionBackup operation result resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class LongTermRetentionBackupOperationResult : ProxyResource + { + /// + /// Initializes a new instance of the + /// LongTermRetentionBackupOperationResult class. + /// + public LongTermRetentionBackupOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// LongTermRetentionBackupOperationResult class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Operation type. + /// Source backup resource + /// id + /// Target backup resource id + /// The storage redundancy + /// type of the copied backup. Possible values include: 'Geo', 'Local', + /// 'Zone' + /// Operation status + /// Progress message + public LongTermRetentionBackupOperationResult(string id = default(string), string name = default(string), string type = default(string), System.Guid? requestId = default(System.Guid?), string operationType = default(string), string fromBackupResourceId = default(string), string toBackupResourceId = default(string), string targetBackupStorageRedundancy = default(string), string status = default(string), string message = default(string)) + : base(id, name, type) + { + RequestId = requestId; + OperationType = operationType; + FromBackupResourceId = fromBackupResourceId; + ToBackupResourceId = toBackupResourceId; + TargetBackupStorageRedundancy = targetBackupStorageRedundancy; + Status = status; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets request Id. + /// + [JsonProperty(PropertyName = "properties.requestId")] + public System.Guid? RequestId { get; private set; } + + /// + /// Gets operation type. + /// + [JsonProperty(PropertyName = "properties.operationType")] + public string OperationType { get; private set; } + + /// + /// Gets source backup resource id + /// + [JsonProperty(PropertyName = "properties.fromBackupResourceId")] + public string FromBackupResourceId { get; private set; } + + /// + /// Gets target backup resource id + /// + [JsonProperty(PropertyName = "properties.toBackupResourceId")] + public string ToBackupResourceId { get; private set; } + + /// + /// Gets the storage redundancy type of the copied backup. Possible + /// values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.targetBackupStorageRedundancy")] + public string TargetBackupStorageRedundancy { get; private set; } + + /// + /// Gets operation status + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets progress message + /// + [JsonProperty(PropertyName = "properties.message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs deleted file mode 100644 index 5bcd5d6f4710..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - - /// - /// Defines values for LongTermRetentionDatabaseState. - /// - public static class LongTermRetentionDatabaseState - { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionPolicy.cs similarity index 83% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionPolicy.cs index 6de249dd2497..2fc7a7309e5e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/LongTermRetentionPolicy.cs @@ -19,20 +19,18 @@ namespace Microsoft.Azure.Management.Sql.Models /// A long term retention policy. /// [Rest.Serialization.JsonTransformation] - public partial class BackupLongTermRetentionPolicy : ProxyResource + public partial class LongTermRetentionPolicy : ProxyResource { /// - /// Initializes a new instance of the BackupLongTermRetentionPolicy - /// class. + /// Initializes a new instance of the LongTermRetentionPolicy class. /// - public BackupLongTermRetentionPolicy() + public LongTermRetentionPolicy() { CustomInit(); } /// - /// Initializes a new instance of the BackupLongTermRetentionPolicy - /// class. + /// Initializes a new instance of the LongTermRetentionPolicy class. /// /// Resource ID. /// Resource name. @@ -45,7 +43,7 @@ public BackupLongTermRetentionPolicy() /// LTR backup in an ISO 8601 format. /// The week of year to take the yearly backup /// in an ISO 8601 format. - public BackupLongTermRetentionPolicy(string id = default(string), string name = default(string), string type = default(string), string weeklyRetention = default(string), string monthlyRetention = default(string), string yearlyRetention = default(string), int? weekOfYear = default(int?)) + public LongTermRetentionPolicy(string id = default(string), string name = default(string), string type = default(string), string weeklyRetention = default(string), string monthlyRetention = default(string), string yearlyRetention = default(string), int? weekOfYear = default(int?)) : base(id, name, type) { WeeklyRetention = weeklyRetention; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs new file mode 100644 index 000000000000..ec615258eb11 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RequestedBackupStorageRedundancy.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for RequestedBackupStorageRedundancy. + /// + public static class RequestedBackupStorageRedundancy + { + public const string Geo = "Geo"; + public const string Local = "Local"; + public const string Zone = "Zone"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState3.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs similarity index 65% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState3.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs index 65ba2f51d2e0..3f5dea96219a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseState3.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TargetBackupStorageRedundancy.cs @@ -12,12 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for DatabaseState3. + /// Defines values for TargetBackupStorageRedundancy. /// - public static class DatabaseState3 + public static class TargetBackupStorageRedundancy { - public const string All = "All"; - public const string Live = "Live"; - public const string Deleted = "Deleted"; + public const string Geo = "Geo"; + public const string Local = "Local"; + public const string Zone = "Zone"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs new file mode 100644 index 000000000000..61a4903dada7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// Contains the information necessary to perform long term retention + /// backup update operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class UpdateLongTermRetentionBackupParameters + { + /// + /// Initializes a new instance of the + /// UpdateLongTermRetentionBackupParameters class. + /// + public UpdateLongTermRetentionBackupParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpdateLongTermRetentionBackupParameters class. + /// + /// The storage + /// redundancy type of the copied backup. Possible values include: + /// 'Geo', 'Local', 'Zone' + public UpdateLongTermRetentionBackupParameters(string requestedBackupStorageRedundancy = default(string)) + { + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage redundancy type of the copied backup. + /// Possible values include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.requestedBackupStorageRedundancy")] + public string RequestedBackupStorageRedundancy { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs index 2a50c9e20ff3..366c1685eb2f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -102,7 +102,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -351,7 +351,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -562,7 +562,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -769,7 +769,7 @@ internal PrivateEndpointConnectionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs index 42bb7ba3d541..feab62484021 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 @@ -19,7 +19,6 @@ public static IEnumerable> ApiInfo_SqlManagementCl { return new Tuple[] { - new Tuple("Sql", "BackupLongTermRetentionPolicies", "2017-03-01-preview"), new Tuple("Sql", "BackupShortTermRetentionPolicies", "2017-10-01-preview"), new Tuple("Sql", "Capabilities", "2020-08-01-preview"), new Tuple("Sql", "DataMaskingPolicies", "2014-04-01"), @@ -34,7 +33,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2017-03-01-preview"), new Tuple("Sql", "Databases", "2014-04-01"), new Tuple("Sql", "Databases", "2020-02-02-preview"), - new Tuple("Sql", "Databases", "2020-08-01-preview"), + new Tuple("Sql", "Databases", "2020-11-01-preview"), new Tuple("Sql", "ElasticPoolActivities", "2014-04-01"), new Tuple("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"), new Tuple("Sql", "ElasticPoolOperations", "2017-10-01-preview"), @@ -58,8 +57,9 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "JobTargetGroups", "2017-03-01-preview"), new Tuple("Sql", "JobVersions", "2017-03-01-preview"), new Tuple("Sql", "Jobs", "2017-03-01-preview"), - new Tuple("Sql", "LongTermRetentionBackups", "2017-03-01-preview"), + new Tuple("Sql", "LongTermRetentionBackups", "2020-11-01-preview"), new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2018-06-01-preview"), + new Tuple("Sql", "LongTermRetentionPolicies", "2020-11-01-preview"), new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2017-03-01-preview"), new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2020-02-02-preview"), new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2017-03-01-preview"), @@ -80,7 +80,7 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2017-03-01-preview"), new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2017-03-01-preview"), new Tuple("Sql", "Operations", "2015-05-01-preview"), - new Tuple("Sql", "PrivateEndpointConnections", "2018-06-01-preview"), + new Tuple("Sql", "PrivateEndpointConnections", "2020-11-01-preview"), new Tuple("Sql", "PrivateLinkResources", "2018-06-01-preview"), new Tuple("Sql", "RecommendedElasticPools", "2014-04-01"), new Tuple("Sql", "RecoverableDatabases", "2014-04-01"), @@ -122,16 +122,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/sql/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=."; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "4d91da06bf655dc1d61a420e7510778eab1609d8"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs index cfeb719c5912..4b4f8b14b582 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -297,16 +297,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IJobVersionsOperations JobVersions { get; private set; } - /// - /// Gets the ILongTermRetentionBackupsOperations. - /// - public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } - - /// - /// Gets the IBackupLongTermRetentionPoliciesOperations. - /// - public virtual IBackupLongTermRetentionPoliciesOperations BackupLongTermRetentionPolicies { get; private set; } - /// /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// @@ -452,11 +442,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IUsagesOperations Usages { get; private set; } - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } - /// /// Gets the IPrivateLinkResourcesOperations. /// @@ -552,6 +537,21 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; private set; } + /// + /// Gets the ILongTermRetentionBackupsOperations. + /// + public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } + + /// + /// Gets the ILongTermRetentionPoliciesOperations. + /// + public virtual ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + /// /// Initializes a new instance of the SqlManagementClient class. /// @@ -838,8 +838,6 @@ private void Initialize() JobTargetExecutions = new JobTargetExecutionsOperations(this); JobTargetGroups = new JobTargetGroupsOperations(this); JobVersions = new JobVersionsOperations(this); - LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); - BackupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesOperations(this); ManagedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesOperations(this); ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(this); ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); @@ -869,7 +867,6 @@ private void Initialize() ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); InstancePools = new InstancePoolsOperations(this); Usages = new UsagesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); Servers = new ServersOperations(this); Capabilities = new CapabilitiesOperations(this); @@ -889,6 +886,9 @@ private void Initialize() ManagedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsOperations(this); ServerTrustGroups = new ServerTrustGroupsOperations(this); ServerDevOpsAuditSettings = new ServerDevOpsAuditSettingsOperations(this); + LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); + LongTermRetentionPolicies = new LongTermRetentionPoliciesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30;