diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs
index 71fde8e99f028..36734624e2f71 100644
--- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs
+++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs
@@ -53,12 +53,12 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Gets a backup instances belonging to a backup vault
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// Headers that will be added to request.
///
@@ -80,23 +80,23 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -105,17 +105,17 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -249,12 +249,12 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Gets a backup instance with name in a backup vault
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -279,23 +279,23 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
if (backupInstanceName == null)
{
@@ -308,8 +308,8 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
@@ -317,9 +317,9 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -454,12 +454,12 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Create or update a backup instance in a backup vault
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -472,22 +472,22 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
/// Delete a backup instance in a backup vault
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -497,22 +497,22 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// The cancellation token.
///
- public async Task> DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
/// Trigger adhoc backup
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -525,78 +525,23 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// The cancellation token.
///
- public async Task> AdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> AdhocBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginAdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginAdhocBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, backupRuleOptions, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
/// Validate whether adhoc backup will be successful or not
///
- ///
- /// The name of the backup vault.
- ///
- ///
- /// The name of the resource group where the backup vault is present.
- ///
- ///
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> ValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// rehydrate recovery point for restore for a BackupInstance
- ///
///
/// The name of the resource group where the backup vault is present.
///
///
/// The name of the backup vault.
///
- ///
- /// Request body for operation
- ///
- ///
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> TriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationHeaderResponse _response = await BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Triggers restore for a BackupInstance
- ///
- ///
- /// The name of the backup vault.
- ///
- ///
- /// The name of the resource group where the backup vault is present.
- ///
- ///
- /// The name of the backup instance
- ///
- ///
- /// Request body for operation
+ ///
///
///
/// The headers that will be added to request.
@@ -604,55 +549,25 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// The cancellation token.
///
- public async Task> TriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ValidateForBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginTriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginValidateForBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstance, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Validates if Restore can be triggered for a DataSource
+ /// Get result of backup instance creation operation
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
- ///
- ///
- /// Gets or sets the restore request object.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> ValidateForRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginValidateForRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Create or update a backup instance in a backup vault
- ///
///
/// The name of the backup vault.
///
- ///
- /// The name of the resource group where the backup vault is present.
- ///
///
- /// The name of the backup instance
///
- ///
- /// Request body for operation
+ ///
///
///
/// Headers that will be added to request.
@@ -675,35 +590,31 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetBackupInstanceOperationResultWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
if (backupInstanceName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
- if (parameters == null)
+ if (operationId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationId");
}
- if (parameters != null)
+ if (Client.ApiVersion == null)
{
- parameters.Validate();
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -712,20 +623,21 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
- tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("operationId", operationId);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetBackupInstanceOperationResult", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -738,7 +650,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -769,12 +681,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Serialize Request
string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -795,7 +701,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -855,24 +761,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- // Deserialize Response
- if ((int)_statusCode == 201)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -881,57 +769,1418 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
///
- /// Delete a backup instance in a backup vault
+ /// rehydrate recovery point for restore for a BackupInstance
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
+ ///
+ /// Request body for operation
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> TriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Triggers restore for a BackupInstance
+ ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
+ ///
+ /// Request body for operation
+ ///
///
- /// Headers that will be added to request.
+ /// 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
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> BeginDeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> TriggerRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (vaultName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
- }
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (Client.SubscriptionId == null)
+ // Send request
+ AzureOperationResponse _response = await BeginTriggerRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// This operation will resume backups for backup instance
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> ResumeBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginResumeBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// This operation will resume protection for a stopped backup instance
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> ResumeProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginResumeProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// This operation will stop protection of a backup instance and data will be
+ /// held forever
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> StopProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginStopProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// This operation will stop backups for backup instance
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> SuspendBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginSuspendBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Sync backup instance again in case of failure
+ /// This action will retry last failed operation and will bring backup instance
+ /// to valid state
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// Field indicating sync type e.g. to sync only in case of failure or in all
+ /// cases. Possible values include: 'Default', 'ForceResync'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> SyncBackupInstanceWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationHeaderResponse _response = await BeginSyncBackupInstanceWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, syncType, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Validates if Restore can be triggered for a DataSource
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Gets or sets the restore request object.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> ValidateForRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginValidateForRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, restoreRequestObject, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Create or update a backup instance in a backup vault
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Request body for 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (backupInstanceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("parameters", parameters);
+ 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete a backup instance in a backup vault
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (backupInstanceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationHeaderResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Trigger adhoc backup
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
+ ///
+ /// 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> BeginAdhocBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (backupInstanceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
+ }
+ if (backupRuleOptions == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupRuleOptions");
+ }
+ if (backupRuleOptions != null)
+ {
+ backupRuleOptions.Validate();
+ }
+ TriggerBackupRequest parameters = new TriggerBackupRequest();
+ if (backupRuleOptions != null)
+ {
+ parameters.BackupRuleOptions = backupRuleOptions;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginAdhocBackup", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Validate whether adhoc backup will be successful or not
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// 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> BeginValidateForBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (backupInstance == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstance");
+ }
+ if (backupInstance != null)
+ {
+ backupInstance.Validate();
+ }
+ ValidateForBackupRequest parameters = new ValidateForBackupRequest();
+ if (backupInstance != null)
+ {
+ parameters.BackupInstance = backupInstance;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginValidateForBackup", 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.DataProtection/backupVaults/{vaultName}/validateForBackup").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// rehydrate recovery point for restore for a BackupInstance
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// Request body for operation
+ ///
+ ///
+ ///
+ ///
+ /// 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> BeginTriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (backupInstanceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRehydrate", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 202 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationHeaderResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Triggers restore for a BackupInstance
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Request body for 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> BeginTriggerRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
if (backupInstanceName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -939,18 +2188,19 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRestore", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -964,7 +2214,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -995,6 +2245,12 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Serialize Request
string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
// Set Credentials
if (Client.Credentials != null)
{
@@ -1015,7 +2271,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -1050,16 +2306,34 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationHeaderResponse();
+ 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);
+ }
+ }
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
catch (JsonException ex)
{
@@ -1078,19 +2352,211 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
///
- /// Trigger adhoc backup
+ /// This operation will resume backups for backup instance
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
+ ///
+ ///
+ ///
+ /// 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> BeginResumeBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (backupInstanceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginResumeBackups", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // 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 AzureOperationHeaderResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// This operation will resume protection for a stopped backup instance
+ ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
///
///
/// Headers that will be added to request.
@@ -1101,9 +2567,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Thrown when the operation returned an invalid status code
///
- ///
- /// Thrown when unable to deserialize the response
- ///
///
/// Thrown when a required parameter is null
///
@@ -1113,40 +2576,27 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginAdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginResumeProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
if (backupInstanceName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
- if (backupRuleOptions == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "backupRuleOptions");
- }
- if (backupRuleOptions != null)
- {
- backupRuleOptions.Validate();
- }
- TriggerBackupRequest parameters = new TriggerBackupRequest();
- if (backupRuleOptions != null)
+ if (Client.ApiVersion == null)
{
- parameters.BackupRuleOptions = backupRuleOptions;
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -1155,19 +2605,18 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
- tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginAdhocBackup", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginResumeProtection", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -1212,12 +2661,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Serialize Request
string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -1273,34 +2716,16 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_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);
- }
- }
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
catch (JsonException ex)
{
@@ -1319,15 +2744,16 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
///
- /// Validate whether adhoc backup will be successful or not
+ /// This operation will stop protection of a backup instance and data will be
+ /// held forever
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
///
///
/// Headers that will be added to request.
@@ -1338,9 +2764,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Thrown when the operation returned an invalid status code
///
- ///
- /// Thrown when unable to deserialize the response
- ///
///
/// Thrown when a required parameter is null
///
@@ -1350,36 +2773,27 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginStopProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- if (backupInstance == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "backupInstance");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
- if (backupInstance != null)
+ if (backupInstanceName == null)
{
- backupInstance.Validate();
+ throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
- ValidateForBackupRequest parameters = new ValidateForBackupRequest();
- if (backupInstance != null)
+ if (Client.ApiVersion == null)
{
- parameters.BackupInstance = backupInstance;
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -1388,18 +2802,19 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("backupInstanceName", backupInstanceName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginValidateForBackup", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginStopProtection", 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.DataProtection/backupVaults/{vaultName}/validateForBackup").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -1443,12 +2858,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Serialize Request
string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -1504,34 +2913,16 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_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);
- }
- }
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
catch (JsonException ex)
{
@@ -1550,7 +2941,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
///
- /// rehydrate recovery point for restore for a BackupInstance
+ /// This operation will stop backups for backup instance
///
///
/// The name of the resource group where the backup vault is present.
@@ -1558,9 +2949,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// The name of the backup vault.
///
- ///
- /// Request body for operation
- ///
///
///
///
@@ -1581,36 +2969,28 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginTriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginSuspendBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
if (vaultName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (parameters != null)
- {
- parameters.Validate();
- }
if (backupInstanceName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1620,16 +3000,15 @@ internal BackupInstancesOperations(DataProtectionClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("parameters", parameters);
tracingParameters.Add("backupInstanceName", backupInstanceName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRehydrate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginSuspendBackups", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
@@ -1675,12 +3054,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Serialize Request
string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -1701,7 +3074,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 202 && (int)_statusCode != 204)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -1736,7 +3109,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationHeaderResponse();
+ var _result = new AzureOperationHeaderResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1745,7 +3118,7 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
catch (JsonException ex)
{
@@ -1764,19 +3137,21 @@ internal BackupInstancesOperations(DataProtectionClient client)
}
///
- /// Triggers restore for a BackupInstance
+ /// Sync backup instance again in case of failure
+ /// This action will retry last failed operation and will bring backup instance
+ /// to valid state
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
- /// The name of the backup instance
///
- ///
- /// Request body for operation
+ ///
+ /// Field indicating sync type e.g. to sync only in case of failure or in all
+ /// cases. Possible values include: 'Default', 'ForceResync'
///
///
/// Headers that will be added to request.
@@ -1787,9 +3162,6 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Thrown when the operation returned an invalid status code
///
- ///
- /// Thrown when unable to deserialize the response
- ///
///
/// Thrown when a required parameter is null
///
@@ -1799,35 +3171,32 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginTriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginSyncBackupInstanceWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
if (backupInstanceName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName");
}
- if (parameters == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (parameters != null)
+ SyncBackupInstanceRequest parameters = new SyncBackupInstanceRequest();
+ if (syncType != null)
{
- parameters.Validate();
+ parameters.SyncType = syncType;
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -1836,19 +3205,19 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRestore", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginSyncBackupInstance", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -1954,34 +3323,16 @@ internal BackupInstancesOperations(DataProtectionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_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);
- }
- }
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
catch (JsonException ex)
{
@@ -2002,12 +3353,12 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// Validates if Restore can be triggered for a DataSource
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -2035,23 +3386,23 @@ internal BackupInstancesOperations(DataProtectionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginValidateForRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginValidateForRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (vaultName == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
- if (Client.SubscriptionId == null)
+ if (vaultName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
if (backupInstanceName == null)
{
@@ -2077,8 +3428,8 @@ internal BackupInstancesOperations(DataProtectionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("backupInstanceName", backupInstanceName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -2087,9 +3438,9 @@ internal BackupInstancesOperations(DataProtectionClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore").ToString();
- _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs
index a1b6ffdb9073a..936b8911f8884 100644
--- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs
+++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs
@@ -27,15 +27,15 @@ public static partial class BackupInstancesOperationsExtensions
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- public static IPage List(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName)
+ ///
+ /// The name of the backup vault.
+ ///
+ public static IPage List(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName)
{
- return operations.ListAsync(vaultName, resourceGroupName).GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, vaultName).GetAwaiter().GetResult();
}
///
@@ -44,18 +44,18 @@ public static IPage List(this IBackupInstancesOperations
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -67,18 +67,18 @@ public static IPage List(this IBackupInstancesOperations
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
- public static BackupInstanceResource Get(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName)
+ public static BackupInstanceResource Get(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.GetAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
@@ -87,21 +87,21 @@ public static BackupInstanceResource Get(this IBackupInstancesOperations operati
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// The cancellation token.
///
- public static async Task GetAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -113,21 +113,21 @@ public static BackupInstanceResource Get(this IBackupInstancesOperations operati
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// Request body for operation
///
- public static BackupInstanceResource CreateOrUpdate(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters)
+ public static BackupInstanceResource CreateOrUpdate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters)
{
- return operations.CreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, vaultName, backupInstanceName, parameters).GetAwaiter().GetResult();
}
///
@@ -136,12 +136,12 @@ public static BackupInstanceResource CreateOrUpdate(this IBackupInstancesOperati
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -151,9 +151,9 @@ public static BackupInstanceResource CreateOrUpdate(this IBackupInstancesOperati
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -165,18 +165,18 @@ public static BackupInstanceResource CreateOrUpdate(this IBackupInstancesOperati
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
- public static BackupInstancesDeleteHeaders Delete(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName)
+ public static BackupInstancesDeleteHeaders Delete(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.DeleteAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult();
+ return operations.DeleteAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
@@ -185,21 +185,21 @@ public static BackupInstancesDeleteHeaders Delete(this IBackupInstancesOperation
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Headers;
}
@@ -211,21 +211,21 @@ public static BackupInstancesDeleteHeaders Delete(this IBackupInstancesOperation
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// Name for the Rule of the Policy which needs to be applied for this backup
///
- public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions)
+ public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions)
{
- return operations.AdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult();
+ return operations.AdhocBackupAsync(resourceGroupName, vaultName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult();
}
///
@@ -234,12 +234,12 @@ public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperatio
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -249,9 +249,9 @@ public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperatio
///
/// The cancellation token.
///
- public static async Task AdhocBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task AdhocBackupAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.AdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.AdhocBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -263,39 +263,87 @@ public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperatio
///
/// The operations group for this extension method.
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
+ ///
+ ///
+ public static OperationJobExtendedInfo ValidateForBackup(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, BackupInstance backupInstance)
+ {
+ return operations.ValidateForBackupAsync(resourceGroupName, vaultName, backupInstance).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Validate whether adhoc backup will be successful or not
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
///
- public static OperationJobExtendedInfo ValidateForBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance)
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ValidateForBackupAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken))
{
- return operations.ValidateForBackupAsync(vaultName, resourceGroupName, backupInstance).GetAwaiter().GetResult();
+ using (var _result = await operations.ValidateForBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstance, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
}
///
- /// Validate whether adhoc backup will be successful or not
+ /// Get result of backup instance creation operation
///
///
/// The operations group for this extension method.
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
+ ///
+ ///
+ ///
+ ///
+ public static BackupInstanceResource GetBackupInstanceOperationResult(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string operationId)
+ {
+ return operations.GetBackupInstanceOperationResultAsync(resourceGroupName, vaultName, backupInstanceName, operationId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get result of backup instance creation operation
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
///
///
/// The cancellation token.
///
- public static async Task ValidateForBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetBackupInstanceOperationResultAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string operationId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetBackupInstanceOperationResultWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, operationId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -357,21 +405,21 @@ public static BackupInstancesTriggerRehydrateHeaders TriggerRehydrate(this IBack
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// Request body for operation
///
- public static OperationJobExtendedInfo TriggerRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters)
+ public static OperationJobExtendedInfo TriggerRestore(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters)
{
- return operations.TriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult();
+ return operations.TriggerRestoreAsync(resourceGroupName, vaultName, backupInstanceName, parameters).GetAwaiter().GetResult();
}
///
@@ -380,12 +428,12 @@ public static OperationJobExtendedInfo TriggerRestore(this IBackupInstancesOpera
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
@@ -395,262 +443,250 @@ public static OperationJobExtendedInfo TriggerRestore(this IBackupInstancesOpera
///
/// The cancellation token.
///
- public static async Task TriggerRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task TriggerRestoreAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.TriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.TriggerRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Validates if Restore can be triggered for a DataSource
+ /// This operation will resume backups for backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Gets or sets the restore request object.
+ ///
///
- public static OperationJobExtendedInfo ValidateForRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject)
+ public static BackupInstancesResumeBackupsHeaders ResumeBackups(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.ValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult();
+ return operations.ResumeBackupsAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
- /// Validates if Restore can be triggered for a DataSource
+ /// This operation will resume backups for backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Gets or sets the restore request object.
+ ///
///
///
/// The cancellation token.
///
- public static async Task ValidateForRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ResumeBackupsAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ValidateForRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ResumeBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ return _result.Headers;
}
}
///
- /// Create or update a backup instance in a backup vault
+ /// This operation will resume protection for a stopped backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Request body for operation
+ ///
///
- public static BackupInstanceResource BeginCreateOrUpdate(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters)
+ public static BackupInstancesResumeProtectionHeaders ResumeProtection(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.BeginCreateOrUpdateAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult();
+ return operations.ResumeProtectionAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
- /// Create or update a backup instance in a backup vault
+ /// This operation will resume protection for a stopped backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Request body for operation
+ ///
///
///
/// The cancellation token.
///
- public static async Task BeginCreateOrUpdateAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ResumeProtectionAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ResumeProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ return _result.Headers;
}
}
///
- /// Delete a backup instance in a backup vault
+ /// This operation will stop protection of a backup instance and data will be
+ /// held forever
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
- /// The name of the backup instance
///
- public static BackupInstancesDeleteHeaders BeginDelete(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName)
+ public static BackupInstancesStopProtectionHeaders StopProtection(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.BeginDeleteAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult();
+ return operations.StopProtectionAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
- /// Delete a backup instance in a backup vault
+ /// This operation will stop protection of a backup instance and data will be
+ /// held forever
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
- /// The name of the backup instance
///
///
/// The cancellation token.
///
- public static async Task BeginDeleteAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task StopProtectionAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.StopProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Headers;
}
}
///
- /// Trigger adhoc backup
+ /// This operation will stop backups for backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
///
- public static OperationJobExtendedInfo BeginAdhocBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions)
+ public static BackupInstancesSuspendBackupsHeaders SuspendBackups(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
{
- return operations.BeginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult();
+ return operations.SuspendBackupsAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
}
///
- /// Trigger adhoc backup
+ /// This operation will stop backups for backup instance
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
- ///
- /// The name of the backup instance
+ ///
+ /// The name of the backup vault.
///
- ///
- /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
///
///
/// The cancellation token.
///
- public static async Task BeginAdhocBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task SuspendBackupsAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginAdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.SuspendBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ return _result.Headers;
}
}
///
- /// Validate whether adhoc backup will be successful or not
+ /// Sync backup instance again in case of failure
+ /// This action will retry last failed operation and will bring backup instance
+ /// to valid state
///
///
/// The operations group for this extension method.
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
- ///
- /// The name of the resource group where the backup vault is present.
+ ///
///
- ///
+ ///
+ /// Field indicating sync type e.g. to sync only in case of failure or in all
+ /// cases. Possible values include: 'Default', 'ForceResync'
///
- public static OperationJobExtendedInfo BeginValidateForBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance)
+ public static BackupInstancesSyncBackupInstanceHeaders SyncBackupInstance(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string))
{
- return operations.BeginValidateForBackupAsync(vaultName, resourceGroupName, backupInstance).GetAwaiter().GetResult();
+ return operations.SyncBackupInstanceAsync(resourceGroupName, vaultName, backupInstanceName, syncType).GetAwaiter().GetResult();
}
///
- /// Validate whether adhoc backup will be successful or not
+ /// Sync backup instance again in case of failure
+ /// This action will retry last failed operation and will bring backup instance
+ /// to valid state
///
///
/// The operations group for this extension method.
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
- ///
- /// The name of the resource group where the backup vault is present.
+ ///
///
- ///
+ ///
+ /// Field indicating sync type e.g. to sync only in case of failure or in all
+ /// cases. Possible values include: 'Default', 'ForceResync'
///
///
/// The cancellation token.
///
- public static async Task BeginValidateForBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task SyncBackupInstanceAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.SyncBackupInstanceWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, syncType, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Body;
+ return _result.Headers;
}
}
///
- /// rehydrate recovery point for restore for a BackupInstance
+ /// Validates if Restore can be triggered for a DataSource
///
///
/// The operations group for this extension method.
@@ -661,18 +697,19 @@ public static OperationJobExtendedInfo BeginValidateForBackup(this IBackupInstan
///
/// The name of the backup vault.
///
- ///
- /// Request body for operation
- ///
///
+ /// The name of the backup instance
///
- public static BackupInstancesTriggerRehydrateHeaders BeginTriggerRehydrate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName)
+ ///
+ /// Gets or sets the restore request object.
+ ///
+ public static OperationJobExtendedInfo ValidateForRestore(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject)
{
- return operations.BeginTriggerRehydrateAsync(resourceGroupName, vaultName, parameters, backupInstanceName).GetAwaiter().GetResult();
+ return operations.ValidateForRestoreAsync(resourceGroupName, vaultName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult();
}
///
- /// rehydrate recovery point for restore for a BackupInstance
+ /// Validates if Restore can be triggered for a DataSource
///
///
/// The operations group for this extension method.
@@ -683,95 +720,551 @@ public static BackupInstancesTriggerRehydrateHeaders BeginTriggerRehydrate(this
///
/// The name of the backup vault.
///
- ///
- /// Request body for operation
- ///
///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Gets or sets the restore request object.
///
///
/// The cancellation token.
///
- public static async Task BeginTriggerRehydrateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ValidateForRestoreAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ValidateForRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false))
{
- return _result.Headers;
+ return _result.Body;
}
}
///
- /// Triggers restore for a BackupInstance
+ /// Create or update a backup instance in a backup vault
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the backup vault.
- ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
///
/// Request body for operation
///
- public static OperationJobExtendedInfo BeginTriggerRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters)
+ public static BackupInstanceResource BeginCreateOrUpdate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters)
{
- return operations.BeginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult();
+ return operations.BeginCreateOrUpdateAsync(resourceGroupName, vaultName, backupInstanceName, parameters).GetAwaiter().GetResult();
}
///
- /// Triggers restore for a BackupInstance
+ /// Create or update a backup instance in a backup vault
///
///
/// The operations group for this extension method.
///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Request body for operation
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateOrUpdateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete a backup instance in a backup vault
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
///
/// The name of the backup vault.
///
+ ///
+ /// The name of the backup instance
+ ///
+ public static BackupInstancesDeleteHeaders BeginDelete(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName)
+ {
+ return operations.BeginDeleteAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete a backup instance in a backup vault
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
///
/// The name of the resource group where the backup vault is present.
///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// The name of the backup instance
///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginDeleteAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
+ }
+
+ ///
+ /// Trigger adhoc backup
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
+ public static OperationJobExtendedInfo BeginAdhocBackup(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions)
+ {
+ return operations.BeginAdhocBackupAsync(resourceGroupName, vaultName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Trigger adhoc backup
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// The name of the backup instance
+ ///
+ ///
+ /// Name for the Rule of the Policy which needs to be applied for this backup
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginAdhocBackupAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginAdhocBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Validate whether adhoc backup will be successful or not
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ public static OperationJobExtendedInfo BeginValidateForBackup(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, BackupInstance backupInstance)
+ {
+ return operations.BeginValidateForBackupAsync(resourceGroupName, vaultName, backupInstance).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Validate whether adhoc backup will be successful or not
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginValidateForBackupAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginValidateForBackupWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstance, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// rehydrate recovery point for restore for a BackupInstance
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
///
/// Request body for operation
///
+ ///
+ ///
+ public static BackupInstancesTriggerRehydrateHeaders BeginTriggerRehydrate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName)
+ {
+ return operations.BeginTriggerRehydrateAsync(resourceGroupName, vaultName, parameters, backupInstanceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// rehydrate recovery point for restore for a BackupInstance
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group where the backup vault is present.
+ ///
+ ///
+ /// The name of the backup vault.
+ ///
+ ///
+ /// Request body for operation
+ ///
+ ///
+ ///
///
/// The cancellation token.
///
- public static async Task BeginTriggerRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task