diff --git a/eng/mgmt/mgmtmetadata/sql_resource-manager.txt b/eng/mgmt/mgmtmetadata/sql_resource-manager.txt index c5656c03bf5d6..4415bef6773c2 100644 --- a/eng/mgmt/mgmtmetadata/sql_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/sql_resource-manager.txt @@ -1,14 +1,14 @@ -Installing AutoRest version: latest +Installing AutoRest version: 2.0.4413 AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/sql/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=. -2020-02-23 19:19:13 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/sql/resource-manager/readme.md --csharp --version=2.0.4413 --reflect-api-versions --csharp-sdks-folder=. +2020-03-03 04:25:24 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: d02e9b574cff98fc6419756545b212db59ded346 +Commit: b61ec0f15e0107933cfb0cb2a554569c7490256e AutoRest information -Requested version: latest +Requested version: 2.0.4413 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ILongTermRetentionManagedInstanceBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ILongTermRetentionManagedInstanceBackupsOperations.cs new file mode 100644 index 0000000000000..624ead6cd7af8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ILongTermRetentionManagedInstanceBackupsOperations.cs @@ -0,0 +1,565 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LongTermRetentionManagedInstanceBackupsOperations operations. + /// + public partial interface ILongTermRetentionManagedInstanceBackupsOperations + { + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 DeleteWithHttpMessagesAsync(string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// 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 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>> ListByInstanceWithHttpMessagesAsync(string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for managed databases in 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' + /// + /// + /// 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>> ListByLocationWithHttpMessagesAsync(string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a long term retention backup for a managed 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. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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> GetByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, 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 + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 DeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all long term retention backups for a managed 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 + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 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>> ListByResourceGroupDatabaseWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// 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 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>> ListByResourceGroupInstanceWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for managed databases in 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. + /// + /// + /// 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 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>> ListByResourceGroupLocationWithHttpMessagesAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 managedInstanceName, string databaseName, 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 + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for managed databases in a + /// given location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the long term retention backups for managed databases in a + /// given location. + /// + /// + /// 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>> ListByResourceGroupLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceLongTermRetentionPoliciesOperations.cs new file mode 100644 index 0000000000000..8082967d60862 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceLongTermRetentionPoliciesOperations.cs @@ -0,0 +1,175 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstanceLongTermRetentionPoliciesOperations operations. + /// + public partial interface IManagedInstanceLongTermRetentionPoliciesOperations + { + /// + /// Gets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy 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.SqlManagement/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs index b11ab7b48f151..1cb03e6da63a4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs @@ -77,11 +77,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } - /// - /// Gets the IServersOperations. - /// - IServersOperations Servers { get; } - /// /// Gets the IServerConnectionPoliciesOperations. /// @@ -132,11 +127,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IReplicationLinksOperations ReplicationLinks { get; } - /// - /// Gets the IServerAzureADAdministratorsOperations. - /// - IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } - /// /// Gets the IServerCommunicationLinksOperations. /// @@ -387,11 +377,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IElasticPoolOperations ElasticPoolOperations { get; } - /// - /// Gets the ICapabilitiesOperations. - /// - ICapabilitiesOperations Capabilities { get; } - /// /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. /// @@ -477,6 +462,36 @@ public partial interface ISqlManagementClient : System.IDisposable /// IManagedInstancesOperations ManagedInstances { get; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IServersOperations. + /// + IServersOperations Servers { get; } + + /// + /// Gets the ICapabilitiesOperations. + /// + ICapabilitiesOperations Capabilities { get; } + + /// + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// + ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } + + /// + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// + IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; } + /// /// Gets the IManagedDatabaseRestoreDetailsOperations. /// @@ -488,14 +503,9 @@ public partial interface ISqlManagementClient : System.IDisposable IManagedDatabasesOperations ManagedDatabases { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } - - /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IServerAzureADAdministratorsOperations. /// - IPrivateLinkResourcesOperations PrivateLinkResources { get; } + IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs new file mode 100644 index 0000000000000..67eb9ce021611 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs @@ -0,0 +1,3278 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LongTermRetentionManagedInstanceBackupsOperations operations. + /// + internal partial class LongTermRetentionManagedInstanceBackupsOperations : IServiceOperations, ILongTermRetentionManagedInstanceBackupsOperations + { + /// + /// Initializes a new instance of the LongTermRetentionManagedInstanceBackupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-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("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(locationName, managedInstanceName, databaseName, backupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 managedInstanceName, string databaseName, 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 (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-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("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (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 managed instance. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// 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>> ListByInstanceWithHttpMessagesAsync(string locationName, string managedInstanceName, 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 (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-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("managedInstanceName", managedInstanceName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _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 managed databases in 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 = "2018-06-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}/longTermRetentionManagedInstanceBackups").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; + } + + /// + /// Gets a long term retention backup for a managed 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. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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> GetByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, 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"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByResourceGroup", 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _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 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all long term retention backups for a managed 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 + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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>> ListByResourceGroupDatabaseWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), 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"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupDatabase", 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (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 managed instance. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// 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>> ListByResourceGroupInstanceWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), 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"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupInstance", 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}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _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 managed databases in 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. + /// + /// + /// 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>> ListByResourceGroupLocationWithHttpMessagesAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), 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"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("onlyLatestPerDatabase", onlyLatestPerDatabase); + tracingParameters.Add("databaseState", databaseState); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupLocation", 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}/longTermRetentionManagedInstanceBackups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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; + } + + /// + /// Deletes a long term retention backup. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string locationName, string managedInstanceName, string databaseName, string backupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-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("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 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 BeginDeleteByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string locationName, string managedInstanceName, string databaseName, 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"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// 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) + { + _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 managed instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInstanceNextWithHttpMessagesAsync(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, "ListByInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// 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>> ListByLocationNextWithHttpMessagesAsync(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, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// 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>> ListByResourceGroupDatabaseNextWithHttpMessagesAsync(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, "ListByResourceGroupDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupInstanceNextWithHttpMessagesAsync(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, "ListByResourceGroupInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// 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>> ListByResourceGroupLocationNextWithHttpMessagesAsync(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, "ListByResourceGroupLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperationsExtensions.cs new file mode 100644 index 0000000000000..ff1fd78f3bfb7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/LongTermRetentionManagedInstanceBackupsOperationsExtensions.cs @@ -0,0 +1,909 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LongTermRetentionManagedInstanceBackupsOperations. + /// + public static partial class LongTermRetentionManagedInstanceBackupsOperationsExtensions + { + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static ManagedInstanceLongTermRetentionBackup Get(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName) + { + return operations.GetAsync(locationName, managedInstanceName, databaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, managedInstanceName, databaseName, 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static void Delete(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName) + { + operations.DeleteAsync(locationName, managedInstanceName, databaseName, 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(locationName, managedInstanceName, databaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByDatabaseAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// 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 ListByInstance(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// 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> ListByInstanceAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInstanceWithHttpMessagesAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for managed databases in 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 ILongTermRetentionManagedInstanceBackupsOperations 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 managed databases in 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 ILongTermRetentionManagedInstanceBackupsOperations 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; + } + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static ManagedInstanceLongTermRetentionBackup GetByResourceGroup(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName) + { + return operations.GetByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task GetByResourceGroupAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static void DeleteByResourceGroup(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName) + { + operations.DeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByResourceGroupAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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 ListByResourceGroupDatabase(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByResourceGroupDatabaseAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the managed 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> ListByResourceGroupDatabaseAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupDatabaseWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// 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 ListByResourceGroupInstance(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByResourceGroupInstanceAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The location of the database. + /// + /// + /// The name of the managed instance. + /// + /// + /// 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> ListByResourceGroupInstanceAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupInstanceWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// 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. + /// + /// + /// 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 ListByResourceGroupLocation(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string)) + { + return operations.ListByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// 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. + /// + /// + /// 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> ListByResourceGroupLocationAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = default(bool?), string databaseState = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupLocationWithHttpMessagesAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static void BeginDelete(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName) + { + operations.BeginDeleteAsync(locationName, managedInstanceName, databaseName, 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(locationName, managedInstanceName, databaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes a 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + public static void BeginDeleteByResourceGroup(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName) + { + operations.BeginDeleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a 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 managed instance. + /// + /// + /// The name of the managed database. + /// + /// + /// The backup name. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteByResourceGroupAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string resourceGroupName, string locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInstanceNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInstanceNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupDatabaseNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all long term retention backups for a managed database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupDatabaseNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupInstanceNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupInstanceNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupLocationNext(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the long term retention backups for managed databases in a given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupLocationNextAsync(this ILongTermRetentionManagedInstanceBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs index 7925d3a9e9651..fef323df26d54 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs @@ -103,7 +103,7 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string restoreDetailsName = "Default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabasesOperations.cs index 2611ef6d650f0..1519bc956ddf4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedDatabasesOperations.cs @@ -95,7 +95,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -625,7 +625,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -851,7 +851,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1044,7 +1044,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1263,7 +1263,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2019-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs new file mode 100644 index 0000000000000..4d53c404517e2 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs @@ -0,0 +1,888 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstanceLongTermRetentionPoliciesOperations operations. + /// + internal partial class ManagedInstanceLongTermRetentionPoliciesOperations : IServiceOperations, IManagedInstanceLongTermRetentionPoliciesOperations + { + /// + /// Initializes a new instance of the ManagedInstanceLongTermRetentionPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string policyName = "default"; + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); + _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; + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when 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 resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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; + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string policyName = "default"; + string apiVersion = "2018-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a 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) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperationsExtensions.cs new file mode 100644 index 0000000000000..a63c2d29d3279 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperationsExtensions.cs @@ -0,0 +1,263 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedInstanceLongTermRetentionPoliciesOperations. + /// + public static partial class ManagedInstanceLongTermRetentionPoliciesOperationsExtensions + { + /// + /// Gets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + public static ManagedInstanceLongTermRetentionPolicy Get(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + public static ManagedInstanceLongTermRetentionPolicy CreateOrUpdate(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + public static IPage ListByDatabase(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + public static ManagedInstanceLongTermRetentionPolicy BeginCreateOrUpdate(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Sets a managed database's long term retention policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the managed instance. + /// + /// + /// The name of the database. + /// + /// + /// The long term retention policy info. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedInstanceLongTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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 IManagedInstanceLongTermRetentionPoliciesOperations 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 IManagedInstanceLongTermRetentionPoliciesOperations 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.SqlManagement/src/Generated/Models/DatabaseState1.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState1.cs new file mode 100644 index 0000000000000..2692f1d2ec2c3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState1.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 DatabaseState1. + /// + public static class DatabaseState1 + { + public const string All = "All"; + public const string Live = "Live"; + public const string Deleted = "Deleted"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState2.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState2.cs new file mode 100644 index 0000000000000..fc0c0446db5ec --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState2.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 DatabaseState2. + /// + public static class DatabaseState2 + { + public const string All = "All"; + public const string Live = "Live"; + public const string Deleted = "Deleted"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState3.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState3.cs new file mode 100644 index 0000000000000..65ba2f51d2e01 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState3.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 DatabaseState3. + /// + public static class DatabaseState3 + { + public const string All = "All"; + public const string Live = "Live"; + public const string Deleted = "Deleted"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState4.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState4.cs new file mode 100644 index 0000000000000..47eff0771e7da --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState4.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 DatabaseState4. + /// + public static class DatabaseState4 + { + public const string All = "All"; + public const string Live = "Live"; + public const string Deleted = "Deleted"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState5.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState5.cs new file mode 100644 index 0000000000000..ce9a5903a7774 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState5.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 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.SqlManagement/src/Generated/Models/DatabaseState6.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState6.cs new file mode 100644 index 0000000000000..dc5e762190072 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/DatabaseState6.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 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.SqlManagement/src/Generated/Models/ManagedDatabase.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabase.cs index 8ed1969f8f522..6cdf5dea9314b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabase.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabase.cs @@ -64,7 +64,8 @@ public ManagedDatabase() /// database by restoring a geo-replicated backup. /// RecoverableDatabaseId must be specified as the recoverable database /// resource ID to restore. Possible values include: 'Default', - /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' + /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', + /// 'RestoreLongTermRetentionBackup' /// Conditional. If createMode is /// RestoreExternalBackup, this value is required. Specifies the uri of /// the storage container where backups for this restore are @@ -83,7 +84,10 @@ public ManagedDatabase() /// The resource identifier of the /// recoverable database associated with create operation of this /// database. - public ManagedDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string)) + /// The name of the + /// Long Term Retention backup to be used for restore of this managed + /// database. + public ManagedDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string), string longTermRetentionBackupResourceId = default(string)) : base(location, id, name, type, tags) { Collation = collation; @@ -100,6 +104,7 @@ public ManagedDatabase() StorageContainerSasToken = storageContainerSasToken; FailoverGroupId = failoverGroupId; RecoverableDatabaseId = recoverableDatabaseId; + LongTermRetentionBackupResourceId = longTermRetentionBackupResourceId; CustomInit(); } @@ -166,7 +171,8 @@ public ManagedDatabase() /// Recovery: Creates a database by restoring a geo-replicated backup. /// RecoverableDatabaseId must be specified as the recoverable database /// resource ID to restore. Possible values include: 'Default', - /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' + /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', + /// 'RestoreLongTermRetentionBackup' /// [JsonProperty(PropertyName = "properties.createMode")] public string CreateMode { get; set; } @@ -214,6 +220,13 @@ public ManagedDatabase() [JsonProperty(PropertyName = "properties.recoverableDatabaseId")] public string RecoverableDatabaseId { get; set; } + /// + /// Gets or sets the name of the Long Term Retention backup to be used + /// for restore of this managed database. + /// + [JsonProperty(PropertyName = "properties.longTermRetentionBackupResourceId")] + public string LongTermRetentionBackupResourceId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseCreateMode.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseCreateMode.cs index 2c9d29bfb2c6b..c7c1e20d82604 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseCreateMode.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseCreateMode.cs @@ -20,5 +20,6 @@ public static class ManagedDatabaseCreateMode public const string RestoreExternalBackup = "RestoreExternalBackup"; public const string PointInTimeRestore = "PointInTimeRestore"; public const string Recovery = "Recovery"; + public const string RestoreLongTermRetentionBackup = "RestoreLongTermRetentionBackup"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseUpdate.cs index d641aed9fb6fb..b942833f2ab45 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedDatabaseUpdate.cs @@ -59,7 +59,8 @@ public ManagedDatabaseUpdate() /// database by restoring a geo-replicated backup. /// RecoverableDatabaseId must be specified as the recoverable database /// resource ID to restore. Possible values include: 'Default', - /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' + /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', + /// 'RestoreLongTermRetentionBackup' /// Conditional. If createMode is /// RestoreExternalBackup, this value is required. Specifies the uri of /// the storage container where backups for this restore are @@ -78,8 +79,11 @@ public ManagedDatabaseUpdate() /// The resource identifier of the /// recoverable database associated with create operation of this /// database. + /// The name of the + /// Long Term Retention backup to be used for restore of this managed + /// database. /// Resource tags. - public ManagedDatabaseUpdate(string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string), IDictionary tags = default(IDictionary)) + public ManagedDatabaseUpdate(string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string), string longTermRetentionBackupResourceId = default(string), IDictionary tags = default(IDictionary)) { Collation = collation; Status = status; @@ -95,6 +99,7 @@ public ManagedDatabaseUpdate() StorageContainerSasToken = storageContainerSasToken; FailoverGroupId = failoverGroupId; RecoverableDatabaseId = recoverableDatabaseId; + LongTermRetentionBackupResourceId = longTermRetentionBackupResourceId; Tags = tags; CustomInit(); } @@ -162,7 +167,8 @@ public ManagedDatabaseUpdate() /// Recovery: Creates a database by restoring a geo-replicated backup. /// RecoverableDatabaseId must be specified as the recoverable database /// resource ID to restore. Possible values include: 'Default', - /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' + /// 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', + /// 'RestoreLongTermRetentionBackup' /// [JsonProperty(PropertyName = "properties.createMode")] public string CreateMode { get; set; } @@ -210,6 +216,13 @@ public ManagedDatabaseUpdate() [JsonProperty(PropertyName = "properties.recoverableDatabaseId")] public string RecoverableDatabaseId { get; set; } + /// + /// Gets or sets the name of the Long Term Retention backup to be used + /// for restore of this managed database. + /// + [JsonProperty(PropertyName = "properties.longTermRetentionBackupResourceId")] + public string LongTermRetentionBackupResourceId { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs new file mode 100644 index 0000000000000..a9b4529edcc40 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs @@ -0,0 +1,105 @@ +// +// 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 long term retention backup for a managed database. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstanceLongTermRetentionBackup : ProxyResource + { + /// + /// Initializes a new instance of the + /// ManagedInstanceLongTermRetentionBackup class. + /// + public ManagedInstanceLongTermRetentionBackup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstanceLongTermRetentionBackup class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The managed instance that the + /// backup database belongs to. + /// The create time of the + /// instance. + /// The name of the database the backup + /// belong to + /// The delete time of the + /// database + /// The time the backup was taken + /// The time the long term retention + /// backup will expire. + public ManagedInstanceLongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string managedInstanceName = default(string), System.DateTime? managedInstanceCreateTime = 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?)) + : base(id, name, type) + { + ManagedInstanceName = managedInstanceName; + ManagedInstanceCreateTime = managedInstanceCreateTime; + DatabaseName = databaseName; + DatabaseDeletionTime = databaseDeletionTime; + BackupTime = backupTime; + BackupExpirationTime = backupExpirationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the managed instance that the backup database belongs to. + /// + [JsonProperty(PropertyName = "properties.managedInstanceName")] + public string ManagedInstanceName { get; private set; } + + /// + /// Gets the create time of the instance. + /// + [JsonProperty(PropertyName = "properties.managedInstanceCreateTime")] + public System.DateTime? ManagedInstanceCreateTime { get; private set; } + + /// + /// Gets the name of the database the backup belong to + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets the delete time of the database + /// + [JsonProperty(PropertyName = "properties.databaseDeletionTime")] + public System.DateTime? DatabaseDeletionTime { get; private set; } + + /// + /// Gets the time the backup was taken + /// + [JsonProperty(PropertyName = "properties.backupTime")] + public System.DateTime? BackupTime { get; private set; } + + /// + /// Gets the time the long term retention backup will expire. + /// + [JsonProperty(PropertyName = "properties.backupExpirationTime")] + public System.DateTime? BackupExpirationTime { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionPolicy.cs new file mode 100644 index 0000000000000..3fef5fc83e1c4 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceLongTermRetentionPolicy.cs @@ -0,0 +1,92 @@ +// +// 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 long term retention policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstanceLongTermRetentionPolicy : ProxyResource + { + /// + /// Initializes a new instance of the + /// ManagedInstanceLongTermRetentionPolicy class. + /// + public ManagedInstanceLongTermRetentionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstanceLongTermRetentionPolicy class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The weekly retention policy for an + /// LTR backup in an ISO 8601 format. + /// The monthly retention policy for an + /// LTR backup in an ISO 8601 format. + /// The yearly retention policy for an + /// LTR backup in an ISO 8601 format. + /// The week of year to take the yearly backup + /// in an ISO 8601 format. + public ManagedInstanceLongTermRetentionPolicy(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; + MonthlyRetention = monthlyRetention; + YearlyRetention = yearlyRetention; + WeekOfYear = weekOfYear; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the weekly retention policy for an LTR backup in an + /// ISO 8601 format. + /// + [JsonProperty(PropertyName = "properties.weeklyRetention")] + public string WeeklyRetention { get; set; } + + /// + /// Gets or sets the monthly retention policy for an LTR backup in an + /// ISO 8601 format. + /// + [JsonProperty(PropertyName = "properties.monthlyRetention")] + public string MonthlyRetention { get; set; } + + /// + /// Gets or sets the yearly retention policy for an LTR backup in an + /// ISO 8601 format. + /// + [JsonProperty(PropertyName = "properties.yearlyRetention")] + public string YearlyRetention { get; set; } + + /// + /// Gets or sets the week of year to take the yearly backup in an ISO + /// 8601 format. + /// + [JsonProperty(PropertyName = "properties.weekOfYear")] + public int? WeekOfYear { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs index 7c6da428b62e1..512b97ba15d53 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs @@ -59,17 +59,19 @@ public static IEnumerable> ApiInfo_SqlManagementCl 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", "LongTermRetentionManagedInstanceBackups", "2018-06-01-preview"), new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2018-06-01-preview"), + new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2019-06-01-preview"), new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2017-03-01-preview"), new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2018-06-01-preview"), new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2017-10-01-preview"), new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabases", "2018-06-01-preview"), + new Tuple("Sql", "ManagedDatabases", "2019-06-01-preview"), new Tuple("Sql", "ManagedInstanceAdministrators", "2017-03-01-preview"), new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2017-10-01-preview"), new Tuple("Sql", "ManagedInstanceKeys", "2017-10-01-preview"), + new Tuple("Sql", "ManagedInstanceLongTermRetentionPolicies", "2018-06-01-preview"), new Tuple("Sql", "ManagedInstanceTdeCertificates", "2017-10-01-preview"), new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2018-06-01-preview"), new Tuple("Sql", "ManagedInstances", "2018-06-01-preview"), @@ -113,16 +115,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - 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=latest --reflect-api-versions --csharp-sdks-folder=."; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "dcd51ecb0bba6cd98f42383f0ef0159efc64a658"; - 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.SqlManagement/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs index d94c31d858eb9..69703676054f5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs @@ -82,11 +82,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } - /// - /// Gets the IServersOperations. - /// - public virtual IServersOperations Servers { get; private set; } - /// /// Gets the IServerConnectionPoliciesOperations. /// @@ -137,11 +132,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } - /// - /// Gets the IServerAzureADAdministratorsOperations. - /// - public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } - /// /// Gets the IServerCommunicationLinksOperations. /// @@ -392,11 +382,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } - /// - /// Gets the ICapabilitiesOperations. - /// - public virtual ICapabilitiesOperations Capabilities { get; private set; } - /// /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. /// @@ -483,24 +468,39 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IManagedInstancesOperations ManagedInstances { get; private set; } /// - /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } /// - /// Gets the IManagedDatabasesOperations. + /// Gets the IPrivateLinkResourcesOperations. /// - public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IServersOperations. /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + public virtual IServersOperations Servers { get; private set; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the ICapabilitiesOperations. /// - public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + public virtual ICapabilitiesOperations Capabilities { get; private set; } + + /// + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// + public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } + + /// + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// + public virtual IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; private set; } + + /// + /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// + public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } /// /// Initializes a new instance of the SqlManagementClient class. @@ -515,6 +515,16 @@ protected SqlManagementClient(HttpClient httpClient, bool disposeHttpClient) : b Initialize(); } + /// + /// Gets the IManagedDatabasesOperations. + /// + public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } + + /// + /// Gets the IServerAzureADAdministratorsOperations. + /// + public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } + /// /// Initializes a new instance of the SqlManagementClient class. /// @@ -732,7 +742,7 @@ public SqlManagementClient(System.Uri baseUri, ServiceClientCredentials credenti { Credentials.InitializeServiceClient(this); } - } + } /// /// An optional partial-method to perform custom initialization. @@ -745,7 +755,6 @@ private void Initialize() { RecoverableDatabases = new RecoverableDatabasesOperations(this); RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); - Servers = new ServersOperations(this); ServerConnectionPolicies = new ServerConnectionPoliciesOperations(this); DatabaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesOperations(this); DataMaskingPolicies = new DataMaskingPoliciesOperations(this); @@ -756,7 +765,6 @@ private void Initialize() ElasticPools = new ElasticPoolsOperations(this); RecommendedElasticPools = new RecommendedElasticPoolsOperations(this); ReplicationLinks = new ReplicationLinksOperations(this); - ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(this); ServerCommunicationLinks = new ServerCommunicationLinksOperations(this); ServiceObjectives = new ServiceObjectivesOperations(this); ElasticPoolActivities = new ElasticPoolActivitiesOperations(this); @@ -807,7 +815,6 @@ private void Initialize() ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); DatabaseOperations = new DatabaseOperations(this); ElasticPoolOperations = new ElasticPoolOperations(this); - Capabilities = new CapabilitiesOperations(this); DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); ManagedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); ManagedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansOperations(this); @@ -825,10 +832,15 @@ private void Initialize() InstancePools = new InstancePoolsOperations(this); Usages = new UsagesOperations(this); ManagedInstances = new ManagedInstancesOperations(this); - ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); - ManagedDatabases = new ManagedDatabasesOperations(this); PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); + Servers = new ServersOperations(this); + Capabilities = new CapabilitiesOperations(this); + LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); + ManagedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesOperations(this); + ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); + ManagedDatabases = new ManagedDatabasesOperations(this); + ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj index 010630449ce6f..b815ece48b6f9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj @@ -7,7 +7,7 @@ Microsoft.Azure.Management.Sql Azure SQL Management SDK library Microsoft.Azure.Management.Sql - 1.38.0-preview + 1.39.0-preview Microsoft Azure SQL Management;SQL;SQL Management; @@ -25,4 +27,4 @@ New features: - \ No newline at end of file + diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Properties/AssemblyInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Properties/AssemblyInfo.cs index d61c3c057f912..2497fb3419634 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Properties/AssemblyInfo.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Properties/AssemblyInfo.cs @@ -22,5 +22,5 @@ [assembly: AssemblyTitle("Microsoft Azure SQL Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure SQL.")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.38.0.0")] +[assembly: AssemblyFileVersion("1.39.0.0")] diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/ManagedInstanceLongTermRetentionTests.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/ManagedInstanceLongTermRetentionTests.cs new file mode 100644 index 0000000000000..b902c195955ca --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/ManagedInstanceLongTermRetentionTests.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using Microsoft.Azure.Management.RecoveryServices; +using Microsoft.Azure.Management.RecoveryServices.Models; +using Microsoft.Azure.Management.RecoveryServices.Backup; +using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Azure.Management.ResourceManager.Models; +using Microsoft.Azure.Management.Sql; +using Microsoft.Azure.Management.Sql.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.Azure; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using Xunit; + +namespace Sql.Tests +{ + public class ManagedInstanceLongTermRetentionTests + { + [Fact] + public void TestManagedInstanceLongTermRetentionPolicies() + { + // MANUAL TEST INSTRUCTIONS + // PlayBack Mode: + // Make sure information below matches what is gets recorded in Session Records + // + string locationName = "southeastasia"; + string resourceGroupName = "sdk-test-rg"; + string managedInstanceName = "sdk-test-mi"; + string defaultPolicy = "PT0S"; + + using (SqlManagementTestContext context = new SqlManagementTestContext(this)) + { + SqlManagementClient sqlClient = context.GetClient(); + ManagedDatabase database = sqlClient.ManagedDatabases.CreateOrUpdate(resourceGroupName, managedInstanceName, SqlManagementTestUtilities.GenerateName(), new ManagedDatabase { Location = locationName }); + + // Get the policy and verify it is the default policy + // + ManagedInstanceLongTermRetentionPolicy policy = sqlClient.ManagedInstanceLongTermRetentionPolicies.Get(resourceGroupName, managedInstanceName, database.Name); + Assert.Equal(defaultPolicy, policy.WeeklyRetention); + Assert.Equal(defaultPolicy, policy.MonthlyRetention); + Assert.Equal(defaultPolicy, policy.YearlyRetention); + Assert.Equal(0, policy.WeekOfYear); + + // Set the retention policy to two weeks for the weekly retention policy + // + ManagedInstanceLongTermRetentionPolicy parameters = new ManagedInstanceLongTermRetentionPolicy(weeklyRetention: "P2W"); + sqlClient.ManagedInstanceLongTermRetentionPolicies.CreateOrUpdate(resourceGroupName, managedInstanceName, database.Name, parameters); + + // Get the policy and verify the weekly policy is two weeks but all the rest stayed the same + // + policy = sqlClient.ManagedInstanceLongTermRetentionPolicies.Get(resourceGroupName, managedInstanceName, database.Name); + Assert.Equal(parameters.WeeklyRetention, policy.WeeklyRetention); + Assert.Equal(defaultPolicy, policy.MonthlyRetention); + Assert.Equal(defaultPolicy, policy.YearlyRetention); + Assert.Equal(0, policy.WeekOfYear); + } + } + + [Fact] + public void TestManagedIntanceLongTermRetentionCrud() + { + // MANUAL TEST INSTRUCTIONS + // PlayBack Mode: + // Make sure information below matches what is gets recorded in Session Records + // Record Mode: + // Create a server and database and fill in the appropriate information below + // Set the weekly retention on the database so that the first backup gets picked up + // Wait about 18 hours until it gets properly copied and you see the backup when run get backups + // OR + // Use existing instance/database that already has LTR backups + // + string locationName = "southeastasia"; + string resourceGroupName = "sdk-test-rg"; + string managedInstanceName = "sdk-test-mi"; + string databaseName = "test"; + + using (SqlManagementTestContext context = new SqlManagementTestContext(this)) + { + SqlManagementClient sqlClient = context.GetClient(); + //ManagedDatabase database = sqlClient.ManagedDatabases.Get(resourceGroupName, managedInstanceName, databaseName); + + // Get the backups under the location, server, and database. Assert there is at least one backup for each call. + // + IPage backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByLocation(locationName); + Assert.True(backups.Count() >= 1); + backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByInstance(locationName, managedInstanceName); + Assert.True(backups.Count() >= 1); + backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByDatabase(locationName, managedInstanceName, databaseName); + Assert.True(backups.Count() >= 1); + + // Get a specific backup using the previous call + // + ManagedInstanceLongTermRetentionBackup backup = sqlClient.LongTermRetentionManagedInstanceBackups.Get(locationName, managedInstanceName, databaseName, backups.First().Name); + Assert.NotNull(backup); + + // Restore the backup + // + ManagedDatabase restoredDatabase = sqlClient.ManagedDatabases.CreateOrUpdate( + resourceGroupName, managedInstanceName, databaseName: SqlManagementTestUtilities.GenerateName(), + parameters: new ManagedDatabase + { + Location = locationName, + CreateMode = CreateMode.RestoreLongTermRetentionBackup, + LongTermRetentionBackupResourceId = backup.Id + }); + } + } + + [Fact] + public void TestManagedInstanceLongTermRetentionResourceGroupBasedCrud() + { + // MANUAL TEST INSTRUCTIONS + // PlayBack Mode: + // Make sure information below matches what is gets recorded in Session Records + // Record Mode: + // Create a server and database and fill in the appropriate information below + // Set the weekly retention on the database so that the first backup gets picked up + // Wait about 18 hours until it gets properly copied and you see the backup when run get backups + // OR + // Use existing instance/database that already has LTR backups + // + string locationName = "southeastasia"; + string resourceGroupName = "sdk-test-rg"; + string managedInstanceName = "sdk-test-mi"; + string databaseName = "test"; + + using (SqlManagementTestContext context = new SqlManagementTestContext(this)) + { + SqlManagementClient sqlClient = context.GetClient(); + //ManagedDatabase database = sqlClient.ManagedDatabases.Get(resourceGroupName, managedInstanceName, databaseName); + + // Get the backups under the location, server, and database. Assert there is at least one backup for each call. + // + IPage backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByResourceGroupLocation(resourceGroupName, locationName); + Assert.True(backups.Count() >= 1); + backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByResourceGroupInstance(resourceGroupName, locationName, managedInstanceName); + Assert.True(backups.Count() >= 1); + backups = sqlClient.LongTermRetentionManagedInstanceBackups.ListByResourceGroupDatabase(resourceGroupName, locationName, managedInstanceName, databaseName); + Assert.True(backups.Count() >= 1); + + // Get a specific backup using the previous call + // + ManagedInstanceLongTermRetentionBackup backup = sqlClient.LongTermRetentionManagedInstanceBackups.GetByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backups.First().Name); + Assert.NotNull(backup); + + // Restore the backup + // + ManagedDatabase restoredDatabase = sqlClient.ManagedDatabases.CreateOrUpdate( + resourceGroupName, managedInstanceName, databaseName: SqlManagementTestUtilities.GenerateName(), + parameters: new ManagedDatabase + { + Location = locationName, + CreateMode = CreateMode.RestoreLongTermRetentionBackup, + LongTermRetentionBackupResourceId = backup.Id + }); + + // Delete the backup. + // + sqlClient.LongTermRetentionManagedInstanceBackups.DeleteByResourceGroupWithHttpMessagesAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backup.Name); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionPolicies.json b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionPolicies.json new file mode 100644 index 0000000000000..ea8754e10d852 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionPolicies.json @@ -0,0 +1,888 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzA/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"southeastasia\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2585d7d8-5be8-4da7-b491-17d82edf812b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "35" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseOperationResults/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview" + ], + "Retry-After": [ + "15" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview" + ], + "x-ms-request-id": [ + "3c77017f-fe37-42f4-83f8-530cea2f6c5a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "41a0474b-e29c-4413-a871-a1d217efed57" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022353Z:41a0474b-e29c-4413-a871-a1d217efed57" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:23:53 GMT" + ], + "Content-Length": [ + "75" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"CreateManagedDatabase\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vM2M3NzAxN2YtZmUzNy00MmY0LTgzZjgtNTMwY2VhMmY2YzVhP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "515e4f80-5c93-45c9-91ee-2d7e79bd2e6c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "fdf42946-331a-4963-a890-25c504e2df4c" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022409Z:fdf42946-331a-4963-a890-25c504e2df4c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:24:09 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c77017f-fe37-42f4-83f8-530cea2f6c5a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vM2M3NzAxN2YtZmUzNy00MmY0LTgzZjgtNTMwY2VhMmY2YzVhP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "d7717239-9993-4d5e-ba03-4c10de643421" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-correlation-request-id": [ + "75573908-4f87-4f33-899b-7e74cf1e48b3" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022424Z:75573908-4f87-4f33-899b-7e74cf1e48b3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:24:23 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c77017f-fe37-42f4-83f8-530cea2f6c5a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vM2M3NzAxN2YtZmUzNy00MmY0LTgzZjgtNTMwY2VhMmY2YzVhP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "294d58c7-77f4-4dc3-a725-79b224c2215f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-correlation-request-id": [ + "4f2fbd6f-f0a6-4a18-9177-ad108c65db0a" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022440Z:4f2fbd6f-f0a6-4a18-9177-ad108c65db0a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:24:39 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c77017f-fe37-42f4-83f8-530cea2f6c5a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vM2M3NzAxN2YtZmUzNy00MmY0LTgzZjgtNTMwY2VhMmY2YzVhP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "43f8d37c-799f-415d-849f-1d2475c5f187" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-correlation-request-id": [ + "085ed2b9-ec29-4126-b7f0-226ef4f24716" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022455Z:085ed2b9-ec29-4126-b7f0-226ef4f24716" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:24:55 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c77017f-fe37-42f4-83f8-530cea2f6c5a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/3c77017f-fe37-42f4-83f8-530cea2f6c5a?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vM2M3NzAxN2YtZmUzNy00MmY0LTgzZjgtNTMwY2VhMmY2YzVhP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "efe11a26-302c-4269-87a5-e7bfd81b9940" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-correlation-request-id": [ + "ba42f5bb-1ed5-4945-b418-05d78fadcc21" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022510Z:ba42f5bb-1ed5-4945-b418-05d78fadcc21" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:10 GMT" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c77017f-fe37-42f4-83f8-530cea2f6c5a\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-03-03T02:23:53.79Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzA/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "27f4d1f3-58a5-4ea6-95a2-5fa3a871dbab" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-correlation-request-id": [ + "fde25c9c-5fe4-42ed-a6e0-9a8bd21c4815" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022511Z:fde25c9c-5fe4-42ed-a6e0-9a8bd21c4815" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:10 GMT" + ], + "Content-Length": [ + "437" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"collation\": \"SQL_Latin1_General_CP1_CI_AS\",\r\n \"status\": \"Online\",\r\n \"creationDate\": \"2020-03-03T02:23:54.37Z\",\r\n \"defaultSecondaryLocation\": \"northeurope\"\r\n },\r\n \"location\": \"southeastasia\",\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830\",\r\n \"name\": \"sqlcrudtest-5830\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzAvYmFja3VwTG9uZ1Rlcm1SZXRlbnRpb25Qb2xpY2llcy9kZWZhdWx0P2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3456621c-d6c6-444e-9bd7-9b617ff902ae" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "b8e6f01f-db15-4bc3-b4d5-8e955fae7170" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-correlation-request-id": [ + "5f9b7c65-f2b6-47b9-8568-8c5190c4e68b" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022512Z:5f9b7c65-f2b6-47b9-8568-8c5190c4e68b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:12 GMT" + ], + "Content-Length": [ + "419" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"weeklyRetention\": \"PT0S\",\r\n \"monthlyRetention\": \"PT0S\",\r\n \"yearlyRetention\": \"PT0S\",\r\n \"weekOfYear\": 0\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default\",\r\n \"name\": \"default\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzAvYmFja3VwTG9uZ1Rlcm1SZXRlbnRpb25Qb2xpY2llcy9kZWZhdWx0P2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "a4daee65-6322-4a43-bc47-05a04e6f6dde" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-correlation-request-id": [ + "ca2961ee-5a31-4786-82dd-47cbde706858" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022559Z:ca2961ee-5a31-4786-82dd-47cbde706858" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:59 GMT" + ], + "Content-Length": [ + "418" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"weeklyRetention\": \"P2W\",\r\n \"monthlyRetention\": \"PT0S\",\r\n \"yearlyRetention\": \"PT0S\",\r\n \"weekOfYear\": 0\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default\",\r\n \"name\": \"default\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzAvYmFja3VwTG9uZ1Rlcm1SZXRlbnRpb25Qb2xpY2llcy9kZWZhdWx0P2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "797257a5-0dad-4d88-a6d3-2e77234f73b5" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "06d6f2a5-36bc-45b3-8cd6-7745558a4ada" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14988" + ], + "x-ms-correlation-request-id": [ + "a222b3c0-0885-4937-a08c-498d33d22c92" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022559Z:a222b3c0-0885-4937-a08c-498d33d22c92" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:59 GMT" + ], + "Content-Length": [ + "418" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"weeklyRetention\": \"P2W\",\r\n \"monthlyRetention\": \"PT0S\",\r\n \"yearlyRetention\": \"PT0S\",\r\n \"weekOfYear\": 0\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default\",\r\n \"name\": \"default\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-5830/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTU4MzAvYmFja3VwTG9uZ1Rlcm1SZXRlbnRpb25Qb2xpY2llcy9kZWZhdWx0P2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"weeklyRetention\": \"P2W\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0bf86f76-9585-48fa-878f-127db8a8203a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "58" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/managedInstanceLongTermRetentionPolicyOperationResults/3c2b4d0e-ce55-4b6d-be38-338625db1bab?api-version=2018-06-01-preview" + ], + "Retry-After": [ + "15" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/3c2b4d0e-ce55-4b6d-be38-338625db1bab?api-version=2018-06-01-preview" + ], + "x-ms-request-id": [ + "3c2b4d0e-ce55-4b6d-be38-338625db1bab" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "b8e0b458-15c3-4932-b903-862d95afd35e" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022512Z:b8e0b458-15c3-4932-b903-862d95afd35e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:12 GMT" + ], + "Content-Length": [ + "90" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpsertDatabaseBackupArchivalPolicyV2\",\r\n \"startTime\": \"2020-03-03T02:25:12.65Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/3c2b4d0e-ce55-4b6d-be38-338625db1bab?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9tYW5hZ2VkSW5zdGFuY2VMb25nVGVybVJldGVudGlvblBvbGljeUF6dXJlQXN5bmNPcGVyYXRpb24vM2MyYjRkMGUtY2U1NS00YjZkLWJlMzgtMzM4NjI1ZGIxYmFiP2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "1f4eba2b-65e7-48ac-878b-f48f328fc1cf" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-correlation-request-id": [ + "c8e86344-a49e-450b-bf46-7cf4b3b0a42d" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022528Z:c8e86344-a49e-450b-bf46-7cf4b3b0a42d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:27 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c2b4d0e-ce55-4b6d-be38-338625db1bab\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:25:12.65Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/3c2b4d0e-ce55-4b6d-be38-338625db1bab?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9tYW5hZ2VkSW5zdGFuY2VMb25nVGVybVJldGVudGlvblBvbGljeUF6dXJlQXN5bmNPcGVyYXRpb24vM2MyYjRkMGUtY2U1NS00YjZkLWJlMzgtMzM4NjI1ZGIxYmFiP2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "1dd76cf1-183a-494a-b7fd-0fd614111b69" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "6ceb9392-efc4-4c18-aebc-d9a1b4be7ef2" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022543Z:6ceb9392-efc4-4c18-aebc-d9a1b4be7ef2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:42 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c2b4d0e-ce55-4b6d-be38-338625db1bab\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:25:12.65Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/3c2b4d0e-ce55-4b6d-be38-338625db1bab?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9tYW5hZ2VkSW5zdGFuY2VMb25nVGVybVJldGVudGlvblBvbGljeUF6dXJlQXN5bmNPcGVyYXRpb24vM2MyYjRkMGUtY2U1NS00YjZkLWJlMzgtMzM4NjI1ZGIxYmFiP2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "6970e5f9-6b36-4a79-959e-68cf9a04f7c8" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-correlation-request-id": [ + "77ae4a78-e527-4c14-a661-f23561847224" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022558Z:77ae4a78-e527-4c14-a661-f23561847224" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:25:58 GMT" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"3c2b4d0e-ce55-4b6d-be38-338625db1bab\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-03-03T02:25:12.65Z\"\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "TestManagedInstanceLongTermRetentionPolicies": [ + "sqlcrudtest-5830" + ] + }, + "Variables": { + "SubscriptionId": "ae88ddf2-85b9-40ed-835e-708db69be09a" + } +} \ No newline at end of file diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionResourceGroupBasedCrud.json b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionResourceGroupBasedCrud.json new file mode 100644 index 0000000000000..ff080e7497085 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedInstanceLongTermRetentionResourceGroupBasedCrud.json @@ -0,0 +1,759 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9sb25nVGVybVJldGVudGlvbk1hbmFnZWRJbnN0YW5jZUJhY2t1cHM/YXBpLXZlcnNpb249MjAxOC0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "c7349db9-491c-47f4-94d8-cc6a1ed7b35a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "568d0284-31f5-4b2e-b1e0-44d17893c345" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "b98d5792-1ccb-4b42-bed7-2210835e43ae" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022830Z:b98d5792-1ccb-4b42-bed7-2210835e43ae" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:29 GMT" + ], + "Content-Length": [ + "4535" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"target1\",\r\n \"backupTime\": \"2020-02-25T00:33:48Z\",\r\n \"backupExpirationTime\": \"2020-03-10T00:33:48Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/target1/longTermRetentionManagedInstanceBackups/ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"name\": \"ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-455\",\r\n \"backupTime\": \"2020-02-27T20:49:41Z\",\r\n \"backupExpirationTime\": \"2020-03-12T20:49:41Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-455/longTermRetentionManagedInstanceBackups/af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"name\": \"af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8305\",\r\n \"backupTime\": \"2020-02-27T23:09:39Z\",\r\n \"backupExpirationTime\": \"2020-03-12T23:09:39Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8305/longTermRetentionManagedInstanceBackups/5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"name\": \"5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8750\",\r\n \"backupTime\": \"2020-02-25T19:33:51Z\",\r\n \"backupExpirationTime\": \"2020-03-10T19:33:51Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8750/longTermRetentionManagedInstanceBackups/869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"name\": \"869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9sb25nVGVybVJldGVudGlvbk1hbmFnZWRJbnN0YW5jZXMvc2VhZ2VvZHItZ2VuNS1ncC9sb25nVGVybVJldGVudGlvbk1hbmFnZWRJbnN0YW5jZUJhY2t1cHM/YXBpLXZlcnNpb249MjAxOC0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "decc1988-2b97-4695-a4b3-5341cfd54fc1" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "f91380c1-08ba-4383-9753-ff3517d11400" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-correlation-request-id": [ + "a49b6f35-0a04-4fd9-a37f-9313b2630331" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022830Z:a49b6f35-0a04-4fd9-a37f-9313b2630331" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:30 GMT" + ], + "Content-Length": [ + "4535" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"target1\",\r\n \"backupTime\": \"2020-02-25T00:33:48Z\",\r\n \"backupExpirationTime\": \"2020-03-10T00:33:48Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/target1/longTermRetentionManagedInstanceBackups/ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"name\": \"ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-455\",\r\n \"backupTime\": \"2020-02-27T20:49:41Z\",\r\n \"backupExpirationTime\": \"2020-03-12T20:49:41Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-455/longTermRetentionManagedInstanceBackups/af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"name\": \"af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8305\",\r\n \"backupTime\": \"2020-02-27T23:09:39Z\",\r\n \"backupExpirationTime\": \"2020-03-12T23:09:39Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8305/longTermRetentionManagedInstanceBackups/5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"name\": \"5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8750\",\r\n \"backupTime\": \"2020-02-25T19:33:51Z\",\r\n \"backupExpirationTime\": \"2020-03-10T19:33:51Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8750/longTermRetentionManagedInstanceBackups/869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"name\": \"869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9sb25nVGVybVJldGVudGlvbk1hbmFnZWRJbnN0YW5jZXMvc2VhZ2VvZHItZ2VuNS1ncC9sb25nVGVybVJldGVudGlvbkRhdGFiYXNlcy90ZXN0L2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlQmFja3Vwcz9hcGktdmVyc2lvbj0yMDE4LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ad549e08-8f5e-4f5b-8ab1-f253cea4e832" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "82957b25-3860-4c96-8913-ca6afa939f6d" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-correlation-request-id": [ + "49c7b236-8168-48f8-9dc9-1e0b6aa92345" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022830Z:49c7b236-8168-48f8-9dc9-1e0b6aa92345" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:30 GMT" + ], + "Content-Length": [ + "1527" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94%3B132271661370000000?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9sb2NhdGlvbnMvc291dGhlYXN0YXNpYS9sb25nVGVybVJldGVudGlvbk1hbmFnZWRJbnN0YW5jZXMvc2VhZ2VvZHItZ2VuNS1ncC9sb25nVGVybVJldGVudGlvbkRhdGFiYXNlcy90ZXN0L2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlQmFja3Vwcy80OTIzYTBjMS1iZmM0LTQ0ZTMtYmY4My0zZWEzZmM3NDFkOTQlM0IxMzIyNzE2NjEzNzAwMDAwMDA/YXBpLXZlcnNpb249MjAxOC0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "962bf56f-91b8-4b49-ac6f-7d42870d2cac" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "36285640-d2b2-43ae-8138-00b000bc7b2f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-correlation-request-id": [ + "663910d1-bebe-4f6e-97c7-9a749be484b7" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022831Z:663910d1-bebe-4f6e-97c7-9a749be484b7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:30 GMT" + ], + "Content-Length": [ + "732" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-4694?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTQ2OTQ/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"createMode\": \"RestoreLongTermRetentionBackup\",\r\n \"longTermRetentionBackupResourceId\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\"\r\n },\r\n \"location\": \"southeastasia\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "711a0d1e-01ac-440a-abdd-7c03701e99d0" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "467" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseOperationResults/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview" + ], + "Retry-After": [ + "15" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview" + ], + "x-ms-request-id": [ + "edccae63-e9a5-41aa-b9d4-c215d2a9451e" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "9d22b7ad-dd0f-4b92-a98c-8b3c19ab5077" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022833Z:9d22b7ad-dd0f-4b92-a98c-8b3c19ab5077" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:32 GMT" + ], + "Content-Length": [ + "95" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"CreateManagedRestoreFromLtrBackupRequest\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "dbf45cc3-ab4a-48c8-b488-507a8e7bc41b" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-correlation-request-id": [ + "1eec5405-766a-4260-857e-6398445d069f" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022849Z:1eec5405-766a-4260-857e-6398445d069f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:48 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "1f2eb1b0-2f7e-4983-b19a-c7e1897f3d02" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-correlation-request-id": [ + "99be985b-2452-4f24-a347-530c90263701" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022904Z:99be985b-2452-4f24-a347-530c90263701" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:29:04 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "3b1570bf-bb56-443e-8252-53316cf2f2e6" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-correlation-request-id": [ + "a6a6e2f8-f256-412f-a0db-df8ab27eb713" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022920Z:a6a6e2f8-f256-412f-a0db-df8ab27eb713" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:29:19 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "f330fca5-685e-45db-9f9e-09b8bf8c1656" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-correlation-request-id": [ + "4f310a54-d8ea-400d-a100-9e227ee1f3a5" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022935Z:4f310a54-d8ea-400d-a100-9e227ee1f3a5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:29:35 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "b113f5ea-039e-4299-9154-3e9ebcba1179" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "60c3d83c-22c3-4861-9a88-80f815b973a3" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022951Z:60c3d83c-22c3-4861-9a88-80f815b973a3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:29:50 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/edccae63-e9a5-41aa-b9d4-c215d2a9451e?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZWRjY2FlNjMtZTlhNS00MWFhLWI5ZDQtYzIxNWQyYTk0NTFlP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "eab2a083-39ce-4493-9ccb-5fa29223837d" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-correlation-request-id": [ + "8fc3270f-e3c7-49b1-ac88-70214f9aa2cc" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T023006Z:8fc3270f-e3c7-49b1-ac88-70214f9aa2cc" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:30:06 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"edccae63-e9a5-41aa-b9d4-c215d2a9451e\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-03-03T02:28:33.607Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-4694?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTQ2OTQ/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "460f9040-e3f3-4735-9d90-b2948eb10aa4" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-correlation-request-id": [ + "d90518fe-0ad0-4031-ae1e-9eb7300485bd" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T023006Z:d90518fe-0ad0-4031-ae1e-9eb7300485bd" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:30:06 GMT" + ], + "Content-Length": [ + "438" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"collation\": \"SQL_Latin1_General_CP1_CI_AS\",\r\n \"status\": \"Online\",\r\n \"creationDate\": \"2020-03-03T02:28:33.873Z\",\r\n \"defaultSecondaryLocation\": \"northeurope\"\r\n },\r\n \"location\": \"southeastasia\",\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-4694\",\r\n \"name\": \"sqlcrudtest-4694\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases\"\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "TestManagedInstanceLongTermRetentionResourceGroupBasedCrud": [ + "sqlcrudtest-4694" + ] + }, + "Variables": { + "SubscriptionId": "ae88ddf2-85b9-40ed-835e-708db69be09a" + } +} \ No newline at end of file diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedIntanceLongTermRetentionCrud.json b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedIntanceLongTermRetentionCrud.json new file mode 100644 index 0000000000000..adce6126fe123 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/SessionRecords/ManagedInstanceLongTermRetentionTests/TestManagedIntanceLongTermRetentionCrud.json @@ -0,0 +1,939 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlQmFja3Vwcz9hcGktdmVyc2lvbj0yMDE4LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "74b34310-c4e7-4e3c-9edb-576197b23f00" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "6084d228-6442-4668-9c1f-c34b2f47168a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "684eb312-36fa-47ff-a8a2-2e27649f5e67" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022603Z:684eb312-36fa-47ff-a8a2-2e27649f5e67" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:03 GMT" + ], + "Content-Length": [ + "4535" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"target1\",\r\n \"backupTime\": \"2020-02-25T00:33:48Z\",\r\n \"backupExpirationTime\": \"2020-03-10T00:33:48Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/target1/longTermRetentionManagedInstanceBackups/ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"name\": \"ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-455\",\r\n \"backupTime\": \"2020-02-27T20:49:41Z\",\r\n \"backupExpirationTime\": \"2020-03-12T20:49:41Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-455/longTermRetentionManagedInstanceBackups/af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"name\": \"af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8305\",\r\n \"backupTime\": \"2020-02-27T23:09:39Z\",\r\n \"backupExpirationTime\": \"2020-03-12T23:09:39Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8305/longTermRetentionManagedInstanceBackups/5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"name\": \"5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8750\",\r\n \"backupTime\": \"2020-02-25T19:33:51Z\",\r\n \"backupExpirationTime\": \"2020-03-10T19:33:51Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8750/longTermRetentionManagedInstanceBackups/869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"name\": \"869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlcy9zZWFnZW9kci1nZW41LWdwL2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlQmFja3Vwcz9hcGktdmVyc2lvbj0yMDE4LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "3a44c718-14b1-495a-9a2f-099549b79ae6" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "6dd3b3ff-a3eb-4008-8236-fdae1c5975c0" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-correlation-request-id": [ + "d6cf80c5-841c-40f4-b480-0f77f1d52580" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022604Z:d6cf80c5-841c-40f4-b480-0f77f1d52580" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:03 GMT" + ], + "Content-Length": [ + "4535" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"target1\",\r\n \"backupTime\": \"2020-02-25T00:33:48Z\",\r\n \"backupExpirationTime\": \"2020-03-10T00:33:48Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/target1/longTermRetentionManagedInstanceBackups/ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"name\": \"ae1ea149-d5ff-4554-9333-33debe0b92ff;132270644280000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-455\",\r\n \"backupTime\": \"2020-02-27T20:49:41Z\",\r\n \"backupExpirationTime\": \"2020-03-12T20:49:41Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-455/longTermRetentionManagedInstanceBackups/af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"name\": \"af08281c-d084-4ba6-accd-506843f03e87;132273101810000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8305\",\r\n \"backupTime\": \"2020-02-27T23:09:39Z\",\r\n \"backupExpirationTime\": \"2020-03-12T23:09:39Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8305/longTermRetentionManagedInstanceBackups/5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"name\": \"5083d673-239d-433b-ab32-8d56bd69e9ae;132273185790000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"sqlcrudtest-8750\",\r\n \"backupTime\": \"2020-02-25T19:33:51Z\",\r\n \"backupExpirationTime\": \"2020-03-10T19:33:51Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/sqlcrudtest-8750/longTermRetentionManagedInstanceBackups/869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"name\": \"869a4e40-bbe8-4703-82d8-d0be49021f66;132271328310000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlcy9zZWFnZW9kci1nZW41LWdwL2xvbmdUZXJtUmV0ZW50aW9uRGF0YWJhc2VzL3Rlc3QvbG9uZ1Rlcm1SZXRlbnRpb25NYW5hZ2VkSW5zdGFuY2VCYWNrdXBzP2FwaS12ZXJzaW9uPTIwMTgtMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "90ac0425-3add-41b9-92b0-09f30e6a7b69" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "da1ae812-b9c2-46e4-b6fd-d01b3522be7f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-correlation-request-id": [ + "3f0972bb-c376-40bf-bf8b-844429fcc960" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022604Z:3f0972bb-c376-40bf-bf8b-844429fcc960" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:03 GMT" + ], + "Content-Length": [ + "1527" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n },\r\n {\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"databaseDeletionTime\": \"2020-02-24T14:56:44.717Z\",\r\n \"backupTime\": \"2020-02-22T06:04:15Z\",\r\n \"backupExpirationTime\": \"2020-03-21T06:04:15Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"name\": \"5e3f5f6c-df6f-4c82-a447-740ee7153b2b;132268250550000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94%3B132271661370000000?api-version=2018-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL2xvbmdUZXJtUmV0ZW50aW9uTWFuYWdlZEluc3RhbmNlcy9zZWFnZW9kci1nZW41LWdwL2xvbmdUZXJtUmV0ZW50aW9uRGF0YWJhc2VzL3Rlc3QvbG9uZ1Rlcm1SZXRlbnRpb25NYW5hZ2VkSW5zdGFuY2VCYWNrdXBzLzQ5MjNhMGMxLWJmYzQtNDRlMy1iZjgzLTNlYTNmYzc0MWQ5NCUzQjEzMjI3MTY2MTM3MDAwMDAwMD9hcGktdmVyc2lvbj0yMDE4LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "c1248416-2a6c-4235-827c-e4c99a9383f5" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "f602b6cb-f0d6-4251-b3bc-a07a1be2b3ae" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-correlation-request-id": [ + "1914a5ac-b646-4a25-8c2e-b2d1438a420a" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022604Z:1914a5ac-b646-4a25-8c2e-b2d1438a420a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:04 GMT" + ], + "Content-Length": [ + "732" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"managedInstanceName\": \"sdk-test-mi\",\r\n \"managedInstanceCreateTime\": \"2019-10-17T16:52:10.627Z\",\r\n \"databaseName\": \"test\",\r\n \"backupTime\": \"2020-02-26T04:48:57Z\",\r\n \"backupExpirationTime\": \"2020-03-11T04:48:57Z\"\r\n },\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"name\": \"4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\",\r\n \"type\": \"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-7853?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTc4NTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"createMode\": \"RestoreLongTermRetentionBackup\",\r\n \"longTermRetentionBackupResourceId\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/sdk-test-mi/longTermRetentionDatabases/test/longTermRetentionManagedInstanceBackups/4923a0c1-bfc4-44e3-bf83-3ea3fc741d94;132271661370000000\"\r\n },\r\n \"location\": \"southeastasia\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a36b75c5-dba7-414e-b1e3-4dc3ebbd0adc" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "467" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseOperationResults/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview" + ], + "Retry-After": [ + "15" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview" + ], + "x-ms-request-id": [ + "d1704967-1148-4f2d-9632-fc134091b030" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "184e2938-68b8-4df7-b766-c9bb1ef1d36e" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022608Z:184e2938-68b8-4df7-b766-c9bb1ef1d36e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:08 GMT" + ], + "Content-Length": [ + "94" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"CreateManagedRestoreFromLtrBackupRequest\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "03e3fbf2-08ba-48d1-bae5-b43102be5523" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-correlation-request-id": [ + "e3c0bdb6-db7a-4ea7-b9e9-0d6c4fc8d302" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022624Z:e3c0bdb6-db7a-4ea7-b9e9-0d6c4fc8d302" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:23 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "68d40dad-4d3b-4387-ae65-f68088784c05" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-correlation-request-id": [ + "b26e878c-f2d9-45d0-8bbd-7e1a948e5160" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022639Z:b26e878c-f2d9-45d0-8bbd-7e1a948e5160" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:39 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "8f819ff1-82b1-46a2-8c28-13361a60769a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-correlation-request-id": [ + "c9a34bbd-5e4a-4536-a5f6-565b21fd07a2" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022654Z:c9a34bbd-5e4a-4536-a5f6-565b21fd07a2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:26:54 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "56f11a1e-2db8-4a85-b5ef-212ca670bf3d" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-correlation-request-id": [ + "d664ce1e-712e-4deb-9b52-7dc6af28e087" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022710Z:d664ce1e-712e-4deb-9b52-7dc6af28e087" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:27:09 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "61dcda3b-8db4-44b4-beb2-07c8b6a1a82c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "b1f1248a-1ba6-46a5-a2c5-989f0c90d973" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022726Z:b1f1248a-1ba6-46a5-a2c5-989f0c90d973" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:27:25 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "97cb1ca3-8506-47b4-a673-d3dda787c628" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-correlation-request-id": [ + "ca01f1eb-e8e3-469a-b6e5-25e963b49cc0" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022741Z:ca01f1eb-e8e3-469a-b6e5-25e963b49cc0" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:27:41 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "90e97d1b-1aa2-4dc9-a58b-ee4cec2e6db3" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-correlation-request-id": [ + "752b871e-2ff6-48cf-a67a-b5aff59bb77c" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022756Z:752b871e-2ff6-48cf-a67a-b5aff59bb77c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:27:55 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "42f6bb64-e292-49ba-9da0-0fe38d139987" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14988" + ], + "x-ms-correlation-request-id": [ + "cd30331b-5def-43e1-aae1-1b9799614e6d" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022812Z:cd30331b-5def-43e1-aae1-1b9799614e6d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:11 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/providers/Microsoft.Sql/locations/southeastasia/managedDatabaseAzureAsyncOperation/d1704967-1148-4f2d-9632-fc134091b030?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3FsL2xvY2F0aW9ucy9zb3V0aGVhc3Rhc2lhL21hbmFnZWREYXRhYmFzZUF6dXJlQXN5bmNPcGVyYXRpb24vZDE3MDQ5NjctMTE0OC00ZjJkLTk2MzItZmMxMzQwOTFiMDMwP2FwaS12ZXJzaW9uPTIwMTktMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-request-id": [ + "d62f2933-0ec5-4b96-ae05-4c38f53b04c8" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14987" + ], + "x-ms-correlation-request-id": [ + "c77c192a-926f-46ef-8b3c-523167016419" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022827Z:c77c192a-926f-46ef-8b3c-523167016419" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:26 GMT" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"d1704967-1148-4f2d-9632-fc134091b030\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-03-03T02:26:08.63Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-7853?api-version=2019-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOGNmYjhiNjItYmNkNi00NzEzLTg5YWQtMTgwOTdmNzVjYzViL3Jlc291cmNlR3JvdXBzL2NsX3N0YWdlX3NlYV9jdi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9tYW5hZ2VkSW5zdGFuY2VzL3NlYWdlb2RyLWdlbjUtZ3AvZGF0YWJhc2VzL3NxbGNydWR0ZXN0LTc4NTM/YXBpLXZlcnNpb249MjAxOS0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.28325.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.14393.", + "Microsoft.Azure.Management.Sql.SqlManagementClient/1.38.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "50b275b3-efbf-41f2-96b3-0cbdb5462769" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14986" + ], + "x-ms-correlation-request-id": [ + "5b81010c-9110-4477-9f8b-6fc81d7a9794" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20200303T022827Z:5b81010c-9110-4477-9f8b-6fc81d7a9794" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 03 Mar 2020 02:28:27 GMT" + ], + "Content-Length": [ + "436" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"collation\": \"SQL_Latin1_General_CP1_CI_AS\",\r\n \"status\": \"Online\",\r\n \"creationDate\": \"2020-03-03T02:26:09.3Z\",\r\n \"defaultSecondaryLocation\": \"northeurope\"\r\n },\r\n \"location\": \"southeastasia\",\r\n \"id\": \"/subscriptions/ae88ddf2-85b9-40ed-835e-708db69be09a/resourceGroups/sdk-test-rg/providers/Microsoft.Sql/managedInstances/sdk-test-mi/databases/sqlcrudtest-7853\",\r\n \"name\": \"sqlcrudtest-7853\",\r\n \"type\": \"Microsoft.Sql/managedInstances/databases\"\r\n}", + "StatusCode": 200 + } + ], + "Names": { + "TestManagedIntanceLongTermRetentionCrud": [ + "sqlcrudtest-7853" + ] + }, + "Variables": { + "SubscriptionId": "ae88ddf2-85b9-40ed-835e-708db69be09a" + } +} \ No newline at end of file