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 BeginTriggerRehydrateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginTriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) { - return _result.Body; + return _result.Headers; } } /// - /// Validates if Restore can be triggered for a DataSource + /// Triggers 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. /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + public static OperationJobExtendedInfo BeginTriggerRestore(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters) + { + return operations.BeginTriggerRestoreAsync(resourceGroupName, vaultName, backupInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Triggers 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. + /// /// /// The name of the backup instance /// - /// - /// Gets or sets the restore request object. + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginTriggerRestoreAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginTriggerRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// This operation will resume backups for backup instance + /// + /// + /// 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 BackupInstancesResumeBackupsHeaders BeginResumeBackups(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName) + { + return operations.BeginResumeBackupsAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// This operation will resume backups for backup instance + /// + /// + /// 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 BeginResumeBackupsAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginResumeBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// This operation will resume protection for a stopped backup instance + /// + /// + /// 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 BackupInstancesResumeProtectionHeaders BeginResumeProtection(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName) + { + return operations.BeginResumeProtectionAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// This operation will resume protection for a stopped backup instance + /// + /// + /// 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 BeginResumeProtectionAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginResumeProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// 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 resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// + public static BackupInstancesStopProtectionHeaders BeginStopProtection(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName) + { + return operations.BeginStopProtectionAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// 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 resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. /// - public static OperationJobExtendedInfo BeginValidateForRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject) + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopProtectionAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopProtectionWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// This operation will stop backups for backup instance + /// + /// + /// 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 BackupInstancesSuspendBackupsHeaders BeginSuspendBackups(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName) + { + return operations.BeginSuspendBackupsAsync(resourceGroupName, vaultName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// This operation will stop backups for backup instance + /// + /// + /// 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 BeginSuspendBackupsAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - return operations.BeginValidateForRestoreAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult(); + using (var _result = await operations.BeginSuspendBackupsWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// 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. + /// + /// + /// + /// + /// Field indicating sync type e.g. to sync only in case of failure or in all + /// cases. Possible values include: 'Default', 'ForceResync' + /// + public static BackupInstancesSyncBackupInstanceHeaders BeginSyncBackupInstance(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string)) + { + return operations.BeginSyncBackupInstanceAsync(resourceGroupName, vaultName, backupInstanceName, syncType).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// + /// 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 BeginSyncBackupInstanceAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginSyncBackupInstanceWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, syncType, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } } /// @@ -780,12 +1273,35 @@ public static OperationJobExtendedInfo BeginValidateForRestore(this IBackupInsta /// /// 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 + /// + /// + /// Gets or sets the restore request object. + /// + public static OperationJobExtendedInfo BeginValidateForRestore(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject) + { + return operations.BeginValidateForRestoreAsync(resourceGroupName, vaultName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult(); + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// 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 /// @@ -795,9 +1311,9 @@ public static OperationJobExtendedInfo BeginValidateForRestore(this IBackupInsta /// /// The cancellation token. /// - public static async Task BeginValidateForRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginValidateForRestoreAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginValidateForRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginValidateForRestoreWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs index f261279d84196..4ca16732db1a1 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs @@ -53,12 +53,12 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// Returns list of backup policies 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 BackupPoliciesOperations(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 BackupPoliciesOperations(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}/backupPolicies").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) { @@ -252,12 +252,12 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// Gets a backup policy 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. + /// /// /// /// @@ -281,23 +281,23 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, 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 (backupPolicyName == null) { @@ -310,8 +310,8 @@ internal BackupPoliciesOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("backupPolicyName", backupPolicyName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -319,9 +319,9 @@ internal BackupPoliciesOperations(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}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -456,12 +456,12 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// Creates or Updates a backup policy 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. + /// /// /// Name of the policy /// @@ -489,23 +489,23 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, BaseBackupPolicyResource parameters, 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 (backupPolicyName == null) { @@ -526,8 +526,8 @@ internal BackupPoliciesOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("backupPolicyName", backupPolicyName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -536,9 +536,9 @@ internal BackupPoliciesOperations(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}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -679,12 +679,12 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// Deletes a backup policy 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. + /// /// /// /// @@ -705,23 +705,23 @@ internal BackupPoliciesOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, 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 (backupPolicyName == null) { @@ -734,8 +734,8 @@ internal BackupPoliciesOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("backupPolicyName", backupPolicyName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); @@ -743,9 +743,9 @@ internal BackupPoliciesOperations(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}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); List _queryParameters = new List(); if (Client.ApiVersion != null) diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs index 7046f6843383c..c6954d31954c8 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs @@ -27,15 +27,15 @@ public static partial class BackupPoliciesOperationsExtensions /// /// 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 IBackupPoliciesOperations operations, string vaultName, string resourceGroupName) + /// + /// The name of the backup vault. + /// + public static IPage List(this IBackupPoliciesOperations 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 IBackupPoliciesOperation /// /// 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 IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IBackupPoliciesOperations 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; } @@ -70,17 +70,17 @@ public static IPage List(this IBackupPoliciesOperation /// /// 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. + /// /// /// - public static BaseBackupPolicyResource Get(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName) + public static BaseBackupPolicyResource Get(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName) { - return operations.GetAsync(vaultName, resourceGroupName, backupPolicyName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, vaultName, backupPolicyName).GetAwaiter().GetResult(); } /// @@ -92,20 +92,20 @@ public static BaseBackupPolicyResource Get(this IBackupPoliciesOperations operat /// /// 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 GetAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -117,21 +117,21 @@ public static BaseBackupPolicyResource Get(this IBackupPoliciesOperations operat /// /// 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. + /// /// /// Name of the policy /// /// /// Request body for operation /// - public static BaseBackupPolicyResource CreateOrUpdate(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters) + public static BaseBackupPolicyResource CreateOrUpdate(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName, BaseBackupPolicyResource parameters) { - return operations.CreateOrUpdateAsync(vaultName, resourceGroupName, backupPolicyName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, vaultName, backupPolicyName, parameters).GetAwaiter().GetResult(); } /// @@ -140,12 +140,12 @@ public static BaseBackupPolicyResource CreateOrUpdate(this IBackupPoliciesOperat /// /// 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. + /// /// /// Name of the policy /// @@ -155,9 +155,9 @@ public static BaseBackupPolicyResource CreateOrUpdate(this IBackupPoliciesOperat /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName, BaseBackupPolicyResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, backupPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -169,17 +169,17 @@ public static BaseBackupPolicyResource CreateOrUpdate(this IBackupPoliciesOperat /// /// 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. + /// /// /// - public static void Delete(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName) + public static void Delete(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName) { - operations.DeleteAsync(vaultName, resourceGroupName, backupPolicyName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, vaultName, backupPolicyName).GetAwaiter().GetResult(); } /// @@ -188,20 +188,20 @@ public static void Delete(this IBackupPoliciesOperations operations, string vaul /// /// 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 DeleteAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IBackupPoliciesOperations operations, string resourceGroupName, string vaultName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vaultName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperations.cs index a467984be25e2..935fd98d1961e 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperations.cs @@ -50,12 +50,12 @@ internal BackupVaultOperationResultsOperations(DataProtectionClient client) /// public DataProtectionClient Client { get; private set; } - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// /// @@ -79,23 +79,23 @@ internal BackupVaultOperationResultsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, 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 (operationId == null) { @@ -108,8 +108,8 @@ internal BackupVaultOperationResultsOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("operationId", operationId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -117,9 +117,9 @@ internal BackupVaultOperationResultsOperations(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}/operationResults/{operationId}").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("{operationId}", System.Uri.EscapeDataString(operationId)); List _queryParameters = new List(); if (Client.ApiVersion != null) diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperationsExtensions.cs index 4c8ef4e40199f..167311f3dae89 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperationsExtensions.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultOperationResultsOperationsExtensions.cs @@ -24,36 +24,36 @@ public static partial class BackupVaultOperationResultsOperationsExtensions /// /// 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. + /// /// /// - public static BackupVaultResource Get(this IBackupVaultOperationResultsOperations operations, string vaultName, string resourceGroupName, string operationId) + public static BackupVaultResource Get(this IBackupVaultOperationResultsOperations operations, string resourceGroupName, string vaultName, string operationId) { - return operations.GetAsync(vaultName, resourceGroupName, operationId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, vaultName, operationId).GetAwaiter().GetResult(); } /// /// 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 GetAsync(this IBackupVaultOperationResultsOperations operations, string vaultName, string resourceGroupName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IBackupVaultOperationResultsOperations operations, string resourceGroupName, string vaultName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, operationId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, operationId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs index b15138438612a..6c22c0d695002 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs @@ -418,12 +418,12 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// Returns a resource belonging to a resource group. /// - /// - /// 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. /// @@ -445,23 +445,23 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(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; @@ -470,17 +470,17 @@ internal BackupVaultsOperations(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, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}").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) { @@ -614,12 +614,12 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// Creates or updates a BackupVault resource belonging to a resource group. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -629,22 +629,22 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Deletes a BackupVault resource from the resource group. /// - /// - /// 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. /// @@ -663,23 +663,23 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(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; @@ -688,17 +688,17 @@ internal BackupVaultsOperations(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, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}").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) { @@ -815,12 +815,12 @@ internal BackupVaultsOperations(DataProtectionClient client) /// Updates a BackupVault resource belonging to a resource group. For example, /// updating tags for a resource. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -830,10 +830,10 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1050,12 +1050,12 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// Creates or updates a BackupVault resource belonging to a resource group. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -1080,23 +1080,23 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupVaultResource parameters, 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 (parameters == null) { @@ -1113,8 +1113,8 @@ internal BackupVaultsOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); @@ -1122,9 +1122,9 @@ internal BackupVaultsOperations(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}").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) { @@ -1283,12 +1283,12 @@ internal BackupVaultsOperations(DataProtectionClient client) /// Updates a BackupVault resource belonging to a resource group. For example, /// updating tags for a resource. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -1313,23 +1313,23 @@ internal BackupVaultsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, 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 (parameters == null) { @@ -1342,8 +1342,8 @@ internal BackupVaultsOperations(DataProtectionClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); @@ -1351,9 +1351,9 @@ internal BackupVaultsOperations(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}").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) { diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs index f4c6667a53505..c25052b2a238e 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs @@ -89,15 +89,15 @@ public static IPage GetInResourceGroup(this IBackupVaultsOp /// /// 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 BackupVaultResource Get(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName) + /// + /// The name of the backup vault. + /// + public static BackupVaultResource Get(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName) { - return operations.GetAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); } /// @@ -106,18 +106,18 @@ public static BackupVaultResource Get(this IBackupVaultsOperations operations, s /// /// 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 GetAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -129,18 +129,18 @@ public static BackupVaultResource Get(this IBackupVaultsOperations operations, s /// /// 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. + /// /// /// Request body for operation /// - public static BackupVaultResource CreateOrUpdate(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters) + public static BackupVaultResource CreateOrUpdate(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, BackupVaultResource parameters) { - return operations.CreateOrUpdateAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, vaultName, parameters).GetAwaiter().GetResult(); } /// @@ -149,21 +149,21 @@ public static BackupVaultResource CreateOrUpdate(this IBackupVaultsOperations op /// /// 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. + /// /// /// Request body for operation /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -175,15 +175,15 @@ public static BackupVaultResource CreateOrUpdate(this IBackupVaultsOperations op /// /// 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 void Delete(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName) + /// + /// The name of the backup vault. + /// + public static void Delete(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName) { - operations.DeleteAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); } /// @@ -192,18 +192,18 @@ public static void Delete(this IBackupVaultsOperations operations, string vaultN /// /// 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 DeleteAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -213,18 +213,18 @@ public static void Delete(this IBackupVaultsOperations operations, string vaultN /// /// 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. + /// /// /// Request body for operation /// - public static BackupVaultResource Update(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters) + public static BackupVaultResource Update(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, PatchResourceRequestInput parameters) { - return operations.UpdateAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, vaultName, parameters).GetAwaiter().GetResult(); } /// @@ -234,21 +234,21 @@ public static BackupVaultResource Update(this IBackupVaultsOperations operations /// /// 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. + /// /// /// Request body for operation /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -306,18 +306,18 @@ public static CheckNameAvailabilityResult CheckNameAvailability(this IBackupVaul /// /// 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. + /// /// /// Request body for operation /// - public static BackupVaultResource BeginCreateOrUpdate(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters) + public static BackupVaultResource BeginCreateOrUpdate(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, BackupVaultResource parameters) { - return operations.BeginCreateOrUpdateAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vaultName, parameters).GetAwaiter().GetResult(); } /// @@ -326,21 +326,21 @@ public static BackupVaultResource BeginCreateOrUpdate(this IBackupVaultsOperatio /// /// 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. + /// /// /// Request body for operation /// /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -353,18 +353,18 @@ public static BackupVaultResource BeginCreateOrUpdate(this IBackupVaultsOperatio /// /// 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. + /// /// /// Request body for operation /// - public static BackupVaultResource BeginUpdate(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters) + public static BackupVaultResource BeginUpdate(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, PatchResourceRequestInput parameters) { - return operations.BeginUpdateAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(resourceGroupName, vaultName, parameters).GetAwaiter().GetResult(); } /// @@ -374,21 +374,21 @@ public static BackupVaultResource BeginUpdate(this IBackupVaultsOperations opera /// /// 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. + /// /// /// Request body for operation /// /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IBackupVaultsOperations operations, string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs index 0f28d046a47c1..f1c223f583f02 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs @@ -89,6 +89,16 @@ public partial class DataProtectionClient : ServiceClient, /// public virtual IOperationStatusOperations OperationStatus { get; private set; } + /// + /// Gets the IOperationStatusBackupVaultContextOperations. + /// + public virtual IOperationStatusBackupVaultContextOperations OperationStatusBackupVaultContext { get; private set; } + + /// + /// Gets the IOperationStatusResourceGroupContextOperations. + /// + public virtual IOperationStatusResourceGroupContextOperations OperationStatusResourceGroupContext { get; private set; } + /// /// Gets the IBackupVaultOperationResultsOperations. /// @@ -388,6 +398,8 @@ private void Initialize() BackupVaults = new BackupVaultsOperations(this); OperationResult = new OperationResultOperations(this); OperationStatus = new OperationStatusOperations(this); + OperationStatusBackupVaultContext = new OperationStatusBackupVaultContextOperations(this); + OperationStatusResourceGroupContext = new OperationStatusResourceGroupContextOperations(this); BackupVaultOperationResults = new BackupVaultOperationResultsOperations(this); DataProtection = new DataProtectionOperations(this); DataProtectionOperations = new DataProtectionOperationsOperations(this); @@ -400,7 +412,7 @@ private void Initialize() ExportJobsOperationResult = new ExportJobsOperationResultOperations(this); ResourceGuards = new ResourceGuardsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-07-01"; + ApiVersion = "2022-01-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs index f434be5b79e1e..6f17e0832b0fd 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs @@ -26,12 +26,12 @@ public partial interface IBackupInstancesOperations /// /// 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. + /// /// /// The headers that will be added to request. /// @@ -47,16 +47,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -75,16 +75,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -106,16 +106,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -131,16 +131,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -163,17 +163,46 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> AdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AdhocBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ValidateForBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get result of backup instance creation operation + /// /// /// 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. @@ -190,7 +219,7 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> ValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetBackupInstanceOperationResultWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// rehydrate recovery point for restore for a BackupInstance /// @@ -221,12 +250,12 @@ public partial interface IBackupInstancesOperations /// /// 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 vault. + /// /// /// The name of the backup instance /// @@ -248,16 +277,143 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> TriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> TriggerRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Validates if Restore can be triggered for a DataSource + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> ResumeBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> ResumeProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> StopProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> SuspendBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> SyncBackupInstanceWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 /// @@ -279,16 +435,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> ValidateForRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidateForRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -310,16 +466,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -335,16 +491,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginDeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 /// @@ -367,16 +523,16 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginAdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginAdhocBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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 name of the backup vault. + /// /// /// /// @@ -394,7 +550,7 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginValidateForBackupWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// rehydrate recovery point for restore for a BackupInstance /// @@ -425,12 +581,12 @@ public partial interface IBackupInstancesOperations /// /// 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 vault. + /// /// /// The name of the backup instance /// @@ -452,16 +608,143 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginTriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginTriggerRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Validates if Restore can be triggered for a DataSource + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginResumeBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginResumeProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginStopProtectionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginSuspendBackupsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginSyncBackupInstanceWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string syncType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 /// @@ -483,7 +766,7 @@ public partial interface IBackupInstancesOperations /// /// Thrown when a required parameter is null /// - Task> BeginValidateForRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginValidateForRestoreWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a backup instances belonging to a backup vault /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs index df8957ca3e52b..c1845e815635b 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs @@ -26,12 +26,12 @@ public partial interface IBackupPoliciesOperations /// /// Returns list of backup policies 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. + /// /// /// The headers that will be added to request. /// @@ -47,19 +47,19 @@ public partial interface IBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a backup policy belonging to a backup vault /// /// /// Gets a backup policy 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. + /// /// /// /// @@ -77,16 +77,16 @@ public partial interface IBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or Updates a backup policy 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. + /// /// /// Name of the policy /// @@ -108,16 +108,16 @@ public partial interface IBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, BaseBackupPolicyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a backup policy 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. + /// /// /// /// @@ -132,7 +132,7 @@ public partial interface IBackupPoliciesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns list of backup policies belonging to a backup vault /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultOperationResultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultOperationResultsOperations.cs index b6af7d56d19f3..38074ce5e3805 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultOperationResultsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultOperationResultsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.DataProtection /// public partial interface IBackupVaultOperationResultsOperations { - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// /// @@ -46,6 +46,6 @@ public partial interface IBackupVaultOperationResultsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs index 91cf4a56e14b1..8bf045d101a05 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs @@ -67,12 +67,12 @@ public partial interface IBackupVaultsOperations /// /// Returns a resource belonging to a resource group. /// - /// - /// 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 headers that will be added to request. /// @@ -88,17 +88,17 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a BackupVault resource belonging to a resource /// group. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -117,16 +117,16 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a BackupVault resource from the resource group. /// - /// - /// 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 headers that will be added to request. /// @@ -139,17 +139,17 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a BackupVault resource belonging to a resource group. For /// example, updating tags for a resource. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -168,7 +168,7 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// API to check for resource name availability /// @@ -201,12 +201,12 @@ public partial interface IBackupVaultsOperations /// Creates or updates a BackupVault resource belonging to a resource /// group. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -225,17 +225,17 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a BackupVault resource belonging to a resource group. For /// example, updating tags for a resource. /// - /// - /// The name of the backup vault. - /// /// /// The name of the resource group where the backup vault is present. /// + /// + /// The name of the backup vault. + /// /// /// Request body for operation /// @@ -254,7 +254,7 @@ public partial interface IBackupVaultsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns resource collection belonging to a subscription. /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs index 2e77377ff7c79..46d41756145ea 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs @@ -84,6 +84,16 @@ public partial interface IDataProtectionClient : System.IDisposable /// IOperationStatusOperations OperationStatus { get; } + /// + /// Gets the IOperationStatusBackupVaultContextOperations. + /// + IOperationStatusBackupVaultContextOperations OperationStatusBackupVaultContext { get; } + + /// + /// Gets the IOperationStatusResourceGroupContextOperations. + /// + IOperationStatusResourceGroupContextOperations OperationStatusResourceGroupContext { get; } + /// /// Gets the IBackupVaultOperationResultsOperations. /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusBackupVaultContextOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusBackupVaultContextOperations.cs new file mode 100644 index 0000000000000..43d5f9ec59448 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusBackupVaultContextOperations.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationStatusBackupVaultContextOperations operations. + /// + public partial interface IOperationStatusBackupVaultContextOperations + { + /// + /// Gets the operation status for an operation over a BackupVault's + /// context. + /// + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusResourceGroupContextOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusResourceGroupContextOperations.cs new file mode 100644 index 0000000000000..479b8c0bcb054 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationStatusResourceGroupContextOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationStatusResourceGroupContextOperations operations. + /// + public partial interface IOperationStatusResourceGroupContextOperations + { + /// + /// Gets the operation status for an operation over a ResourceGroup's + /// context. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs index 795eb564e7921..c0b1865039823 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs @@ -27,12 +27,12 @@ public partial interface IRecoveryPointsOperations /// /// Returns a list of Recovery Points for a DataSource in a 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 /// @@ -57,16 +57,16 @@ public partial interface IRecoveryPointsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a Recovery Point using recoveryPointId 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 /// @@ -87,7 +87,7 @@ public partial interface IRecoveryPointsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns a list of Recovery Points for a DataSource in a vault. /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRestorableTimeRangesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRestorableTimeRangesOperations.cs index 86522466f5bf9..5fa3d406a88ce 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRestorableTimeRangesOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRestorableTimeRangesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.DataProtection /// public partial interface IRestorableTimeRangesOperations { - /// - /// 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 /// @@ -50,6 +50,6 @@ public partial interface IRestorableTimeRangesOperations /// /// Thrown when a required parameter is null /// - Task> FindWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> FindWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs index 35b08d7f53bef..8da64735ecb52 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs @@ -41,8 +41,10 @@ public AzureBackupRecoveryPointBasedRestoreRequest() /// Gets or sets the type of the /// source data store. Possible values include: 'ArchiveStore', /// 'SnapshotStore', 'VaultStore' - public AzureBackupRecoveryPointBasedRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId) - : base(restoreTargetInfo, sourceDataStoreType) + /// Fully qualified Azure Resource + /// Manager ID of the datasource which is being recovered. + public AzureBackupRecoveryPointBasedRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId, string sourceResourceId = default(string)) + : base(restoreTargetInfo, sourceDataStoreType, sourceResourceId) { RecoveryPointId = recoveryPointId; CustomInit(); diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryTimeBasedRestoreRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryTimeBasedRestoreRequest.cs index facb67aca110b..1e42bc6a475e3 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryTimeBasedRestoreRequest.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryTimeBasedRestoreRequest.cs @@ -43,8 +43,10 @@ public AzureBackupRecoveryTimeBasedRestoreRequest() /// 'SnapshotStore', 'VaultStore' /// The recovery time in ISO 8601 /// format example - 2020-08-14T17:30:00.0000000Z. - public AzureBackupRecoveryTimeBasedRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointTime) - : base(restoreTargetInfo, sourceDataStoreType) + /// Fully qualified Azure Resource + /// Manager ID of the datasource which is being recovered. + public AzureBackupRecoveryTimeBasedRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointTime, string sourceResourceId = default(string)) + : base(restoreTargetInfo, sourceDataStoreType, sourceResourceId) { RecoveryPointTime = recoveryPointTime; CustomInit(); diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs index 51f4ca15a49d1..1185586376d44 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs @@ -39,10 +39,13 @@ public AzureBackupRestoreRequest() /// Gets or sets the type of the /// source data store. Possible values include: 'ArchiveStore', /// 'SnapshotStore', 'VaultStore' - public AzureBackupRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType) + /// Fully qualified Azure Resource + /// Manager ID of the datasource which is being recovered. + public AzureBackupRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string sourceResourceId = default(string)) { RestoreTargetInfo = restoreTargetInfo; SourceDataStoreType = sourceDataStoreType; + SourceResourceId = sourceResourceId; CustomInit(); } @@ -64,6 +67,13 @@ public AzureBackupRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string [JsonProperty(PropertyName = "sourceDataStoreType")] public string SourceDataStoreType { get; set; } + /// + /// Gets or sets fully qualified Azure Resource Manager ID of the + /// datasource which is being recovered. + /// + [JsonProperty(PropertyName = "sourceResourceId")] + public string SourceResourceId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs index 2389fa6656173..cb38ae600337c 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs @@ -46,8 +46,10 @@ public AzureBackupRestoreWithRehydrationRequest() /// 'Invalid', 'High', 'Standard' /// Retention duration in /// ISO 8601 format i.e P10D . - public AzureBackupRestoreWithRehydrationRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId, string rehydrationPriority, string rehydrationRetentionDuration) - : base(restoreTargetInfo, sourceDataStoreType, recoveryPointId) + /// Fully qualified Azure Resource + /// Manager ID of the datasource which is being recovered. + public AzureBackupRestoreWithRehydrationRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId, string rehydrationPriority, string rehydrationRetentionDuration, string sourceResourceId = default(string)) + : base(restoreTargetInfo, sourceDataStoreType, recoveryPointId, sourceResourceId) { RehydrationPriority = rehydrationPriority; RehydrationRetentionDuration = rehydrationRetentionDuration; diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs index 701fd43356cc6..1a5e83b853d47 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs @@ -53,7 +53,11 @@ public BackupInstance() /// the resource i.e. provisioning/updating/Succeeded/Failed /// Credentials to use to /// authenticate with data source provider. - public BackupInstance(Datasource dataSourceInfo, PolicyInfo policyInfo, string objectType, string friendlyName = default(string), DatasourceSet dataSourceSetInfo = default(DatasourceSet), ProtectionStatusDetails protectionStatus = default(ProtectionStatusDetails), string currentProtectionState = default(string), UserFacingError protectionErrorDetails = default(UserFacingError), string provisioningState = default(string), AuthCredentials datasourceAuthCredentials = default(AuthCredentials)) + /// Specifies the type of validation. In + /// case of DeepValidation, all validations from /validateForBackup API + /// will run again. Possible values include: 'ShallowValidation', + /// 'DeepValidation' + public BackupInstance(Datasource dataSourceInfo, PolicyInfo policyInfo, string objectType, string friendlyName = default(string), DatasourceSet dataSourceSetInfo = default(DatasourceSet), ProtectionStatusDetails protectionStatus = default(ProtectionStatusDetails), string currentProtectionState = default(string), UserFacingError protectionErrorDetails = default(UserFacingError), string provisioningState = default(string), AuthCredentials datasourceAuthCredentials = default(AuthCredentials), string validationType = default(string)) { FriendlyName = friendlyName; DataSourceInfo = dataSourceInfo; @@ -64,6 +68,7 @@ public BackupInstance() ProtectionErrorDetails = protectionErrorDetails; ProvisioningState = provisioningState; DatasourceAuthCredentials = datasourceAuthCredentials; + ValidationType = validationType; ObjectType = objectType; CustomInit(); } @@ -135,6 +140,15 @@ public BackupInstance() [JsonProperty(PropertyName = "datasourceAuthCredentials")] public AuthCredentials DatasourceAuthCredentials { get; set; } + /// + /// Gets or sets specifies the type of validation. In case of + /// DeepValidation, all validations from /validateForBackup API will + /// run again. Possible values include: 'ShallowValidation', + /// 'DeepValidation' + /// + [JsonProperty(PropertyName = "validationType")] + public string ValidationType { get; set; } + /// /// [JsonProperty(PropertyName = "objectType")] diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesCreateOrUpdateHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..68962ca264ec9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesCreateOrUpdateHeaders.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class BackupInstancesCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesCreateOrUpdateHeaders class. + /// + public BackupInstancesCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesCreateOrUpdateHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + public BackupInstancesCreateOrUpdateHeaders(string location = default(string), string azureAsyncOperation = default(string)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeBackupsHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeBackupsHeaders.cs new file mode 100644 index 0000000000000..312856157c07f --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeBackupsHeaders.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ResumeBackups operation. + /// + public partial class BackupInstancesResumeBackupsHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesResumeBackupsHeaders class. + /// + public BackupInstancesResumeBackupsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesResumeBackupsHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesResumeBackupsHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeProtectionHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeProtectionHeaders.cs new file mode 100644 index 0000000000000..3ea10d792033c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesResumeProtectionHeaders.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ResumeProtection operation. + /// + public partial class BackupInstancesResumeProtectionHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesResumeProtectionHeaders class. + /// + public BackupInstancesResumeProtectionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesResumeProtectionHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesResumeProtectionHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesStopProtectionHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesStopProtectionHeaders.cs new file mode 100644 index 0000000000000..ffd77071d1585 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesStopProtectionHeaders.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StopProtection operation. + /// + public partial class BackupInstancesStopProtectionHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesStopProtectionHeaders class. + /// + public BackupInstancesStopProtectionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesStopProtectionHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesStopProtectionHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSuspendBackupsHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSuspendBackupsHeaders.cs new file mode 100644 index 0000000000000..da4376f28ff5e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSuspendBackupsHeaders.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for SuspendBackups operation. + /// + public partial class BackupInstancesSuspendBackupsHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesSuspendBackupsHeaders class. + /// + public BackupInstancesSuspendBackupsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesSuspendBackupsHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesSuspendBackupsHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSyncBackupInstanceHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSyncBackupInstanceHeaders.cs new file mode 100644 index 0000000000000..25447eedc7685 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesSyncBackupInstanceHeaders.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for SyncBackupInstance operation. + /// + public partial class BackupInstancesSyncBackupInstanceHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesSyncBackupInstanceHeaders class. + /// + public BackupInstancesSyncBackupInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesSyncBackupInstanceHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesSyncBackupInstanceHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SecretStoreResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SecretStoreResource.cs index 3bfbd797ee84c..773f9adb568c9 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SecretStoreResource.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SecretStoreResource.cs @@ -33,10 +33,13 @@ public SecretStoreResource() /// Gets or sets the type of secret /// store. Possible values include: 'Invalid', 'AzureKeyVault' /// Uri to get to the resource - public SecretStoreResource(string secretStoreType, string uri = default(string)) + /// Gets or sets value stored in secret store + /// resource + public SecretStoreResource(string secretStoreType, string uri = default(string), string value = default(string)) { Uri = uri; SecretStoreType = secretStoreType; + Value = value; CustomInit(); } @@ -58,6 +61,12 @@ public SecretStoreResource() [JsonProperty(PropertyName = "secretStoreType")] public string SecretStoreType { get; set; } + /// + /// Gets or sets value stored in secret store resource + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + /// /// Validate the object. /// diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncBackupInstanceRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncBackupInstanceRequest.cs new file mode 100644 index 0000000000000..c6244066a04a8 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncBackupInstanceRequest.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sync BackupInstance Request + /// + public partial class SyncBackupInstanceRequest + { + /// + /// Initializes a new instance of the SyncBackupInstanceRequest class. + /// + public SyncBackupInstanceRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SyncBackupInstanceRequest class. + /// + /// Field indicating sync type e.g. to sync only + /// in case of failure or in all cases. Possible values include: + /// 'Default', 'ForceResync' + public SyncBackupInstanceRequest(string syncType = default(string)) + { + SyncType = syncType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets field indicating sync type e.g. to sync only in case + /// of failure or in all cases. Possible values include: 'Default', + /// 'ForceResync' + /// + [JsonProperty(PropertyName = "syncType")] + public string SyncType { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncType.cs new file mode 100644 index 0000000000000..18084a43b0db5 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SyncType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + + /// + /// Defines values for SyncType. + /// + public static class SyncType + { + public const string Default = "Default"; + public const string ForceResync = "ForceResync"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidationType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidationType.cs new file mode 100644 index 0000000000000..01caaba453c08 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + + /// + /// Defines values for ValidationType. + /// + public static class ValidationType + { + public const string ShallowValidation = "ShallowValidation"; + public const string DeepValidation = "DeepValidation"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperations.cs new file mode 100644 index 0000000000000..5aa1aa39623cf --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperations.cs @@ -0,0 +1,258 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationStatusBackupVaultContextOperations operations. + /// + internal partial class OperationStatusBackupVaultContextOperations : IServiceOperations, IOperationStatusBackupVaultContextOperations + { + /// + /// Initializes a new instance of the OperationStatusBackupVaultContextOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationStatusBackupVaultContextOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets the operation status for an operation over a BackupVault's context. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, 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 (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + 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("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{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("{operationId}", System.Uri.EscapeDataString(operationId)); + 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("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperationsExtensions.cs new file mode 100644 index 0000000000000..50120283f7e20 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusBackupVaultContextOperationsExtensions.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationStatusBackupVaultContextOperations. + /// + public static partial class OperationStatusBackupVaultContextOperationsExtensions + { + /// + /// Gets the operation status for an operation over a BackupVault's context. + /// + /// + /// 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 OperationResource Get(this IOperationStatusBackupVaultContextOperations operations, string resourceGroupName, string vaultName, string operationId) + { + return operations.GetAsync(resourceGroupName, vaultName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation status for an operation over a BackupVault's context. + /// + /// + /// 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 GetAsync(this IOperationStatusBackupVaultContextOperations operations, string resourceGroupName, string vaultName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperations.cs new file mode 100644 index 0000000000000..6320b832ff649 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperations.cs @@ -0,0 +1,249 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationStatusResourceGroupContextOperations operations. + /// + internal partial class OperationStatusResourceGroupContextOperations : IServiceOperations, IOperationStatusResourceGroupContextOperations + { + /// + /// Initializes a new instance of the OperationStatusResourceGroupContextOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationStatusResourceGroupContextOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets the operation status for an operation over a ResourceGroup's context. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationId, 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 (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperationsExtensions.cs new file mode 100644 index 0000000000000..cc9a42ae5d78b --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationStatusResourceGroupContextOperationsExtensions.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationStatusResourceGroupContextOperations. + /// + public static partial class OperationStatusResourceGroupContextOperationsExtensions + { + /// + /// Gets the operation status for an operation over a ResourceGroup's context. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static OperationResource Get(this IOperationStatusResourceGroupContextOperations operations, string resourceGroupName, string operationId) + { + return operations.GetAsync(resourceGroupName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation status for an operation over a ResourceGroup's context. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOperationStatusResourceGroupContextOperations operations, string resourceGroupName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs index 495bb0d4ccbf0..30dbf49e13af1 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs @@ -54,12 +54,12 @@ internal RecoveryPointsOperations(DataProtectionClient client) /// /// Returns a list of Recovery Points for a DataSource in a 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 /// @@ -90,23 +90,23 @@ internal RecoveryPointsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = 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) { @@ -120,8 +120,8 @@ internal RecoveryPointsOperations(DataProtectionClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("backupInstanceName", backupInstanceName); tracingParameters.Add("skipToken", skipToken); tracingParameters.Add("cancellationToken", cancellationToken); @@ -130,9 +130,9 @@ internal RecoveryPointsOperations(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}/recoveryPoints").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 (odataQuery != null) @@ -279,12 +279,12 @@ internal RecoveryPointsOperations(DataProtectionClient client) /// /// Gets a Recovery Point using recoveryPointId 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 /// @@ -311,23 +311,23 @@ internal RecoveryPointsOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, string recoveryPointId, 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) { @@ -344,8 +344,8 @@ internal RecoveryPointsOperations(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("recoveryPointId", recoveryPointId); tracingParameters.Add("cancellationToken", cancellationToken); @@ -354,9 +354,9 @@ internal RecoveryPointsOperations(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}/recoveryPoints/{recoveryPointId}").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)); _url = _url.Replace("{recoveryPointId}", System.Uri.EscapeDataString(recoveryPointId)); List _queryParameters = new List(); diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs index f7bef6b42c2c9..5b9e36687dd80 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs @@ -28,12 +28,12 @@ public static partial class RecoveryPointsOperationsExtensions /// /// 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 /// @@ -43,9 +43,9 @@ public static partial class RecoveryPointsOperationsExtensions /// /// skipToken Filter. /// - public static IPage List(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + public static IPage List(this IRecoveryPointsOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) { - return operations.ListAsync(vaultName, resourceGroupName, backupInstanceName, odataQuery, skipToken).GetAwaiter().GetResult(); + return operations.ListAsync(resourceGroupName, vaultName, backupInstanceName, odataQuery, skipToken).GetAwaiter().GetResult(); } /// @@ -54,12 +54,12 @@ public static partial class RecoveryPointsOperationsExtensions /// /// 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 /// @@ -72,9 +72,9 @@ public static partial class RecoveryPointsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IRecoveryPointsOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -86,20 +86,20 @@ public static partial class RecoveryPointsOperationsExtensions /// /// 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 AzureBackupRecoveryPointResource Get(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId) + public static AzureBackupRecoveryPointResource Get(this IRecoveryPointsOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string recoveryPointId) { - return operations.GetAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, vaultName, backupInstanceName, recoveryPointId).GetAwaiter().GetResult(); } /// @@ -108,12 +108,12 @@ public static AzureBackupRecoveryPointResource Get(this IRecoveryPointsOperation /// /// 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 /// @@ -122,9 +122,9 @@ public static AzureBackupRecoveryPointResource Get(this IRecoveryPointsOperation /// /// The cancellation token. /// - public static async Task GetAsync(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IRecoveryPointsOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, string recoveryPointId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, recoveryPointId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperations.cs index 2357ca365025c..52c37b073cf99 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperations.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperations.cs @@ -50,12 +50,12 @@ internal RestorableTimeRangesOperations(DataProtectionClient client) /// public DataProtectionClient Client { get; private set; } - /// - /// 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 /// @@ -83,23 +83,23 @@ internal RestorableTimeRangesOperations(DataProtectionClient client) /// /// A response object containing the response body and response headers. /// - public async Task> FindWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> FindWithHttpMessagesAsync(string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, 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) { @@ -120,8 +120,8 @@ internal RestorableTimeRangesOperations(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); @@ -130,9 +130,9 @@ internal RestorableTimeRangesOperations(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}/findRestorableTimeRanges").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/RestorableTimeRangesOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperationsExtensions.cs index 97be9ff2db1e5..a0c6dfaff1c8a 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperationsExtensions.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RestorableTimeRangesOperationsExtensions.cs @@ -24,32 +24,32 @@ public static partial class RestorableTimeRangesOperationsExtensions /// /// 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 AzureBackupFindRestorableTimeRangesResponseResource Find(this IRestorableTimeRangesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters) + public static AzureBackupFindRestorableTimeRangesResponseResource Find(this IRestorableTimeRangesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters) { - return operations.FindAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult(); + return operations.FindAsync(resourceGroupName, vaultName, backupInstanceName, parameters).GetAwaiter().GetResult(); } /// /// 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 /// @@ -59,9 +59,9 @@ public static AzureBackupFindRestorableTimeRangesResponseResource Find(this IRes /// /// The cancellation token. /// - public static async Task FindAsync(this IRestorableTimeRangesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task FindAsync(this IRestorableTimeRangesOperations operations, string resourceGroupName, string vaultName, string backupInstanceName, AzureBackupFindRestorableTimeRangesRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.FindWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.FindWithHttpMessagesAsync(resourceGroupName, vaultName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs index d122a4fd5b9d8..dea9a15e3eaa5 100644 --- a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs @@ -19,33 +19,24 @@ public static IEnumerable> ApiInfo_DataProtectionC { return new Tuple[] { - new Tuple("DataProtection", "BackupInstances", "2021-07-01"), - new Tuple("DataProtection", "BackupPolicies", "2021-07-01"), - new Tuple("DataProtection", "BackupVaultOperationResults", "2021-07-01"), - new Tuple("DataProtection", "BackupVaults", "2021-07-01"), - new Tuple("DataProtection", "DataProtection", "2021-07-01"), - new Tuple("DataProtection", "DataProtectionOperations", "2021-07-01"), - new Tuple("DataProtection", "ExportJobs", "2021-07-01"), - new Tuple("DataProtection", "ExportJobsOperationResult", "2021-07-01"), - new Tuple("DataProtection", "Jobs", "2021-07-01"), - new Tuple("DataProtection", "OperationResult", "2021-07-01"), - new Tuple("DataProtection", "OperationStatus", "2021-07-01"), - new Tuple("DataProtection", "RecoveryPoints", "2021-07-01"), - new Tuple("DataProtection", "ResourceGuards", "2021-07-01"), - new Tuple("DataProtection", "RestorableTimeRanges", "2021-07-01"), + new Tuple("DataProtection", "BackupInstances", "2022-01-01"), + new Tuple("DataProtection", "BackupPolicies", "2022-01-01"), + new Tuple("DataProtection", "BackupVaultOperationResults", "2022-01-01"), + new Tuple("DataProtection", "BackupVaults", "2022-01-01"), + new Tuple("DataProtection", "DataProtection", "2022-01-01"), + new Tuple("DataProtection", "DataProtectionOperations", "2022-01-01"), + new Tuple("DataProtection", "ExportJobs", "2022-01-01"), + new Tuple("DataProtection", "ExportJobsOperationResult", "2022-01-01"), + new Tuple("DataProtection", "Jobs", "2022-01-01"), + new Tuple("DataProtection", "OperationResult", "2022-01-01"), + new Tuple("DataProtection", "OperationStatus", "2022-01-01"), + new Tuple("DataProtection", "OperationStatusBackupVaultContext", "2022-01-01"), + new Tuple("DataProtection", "OperationStatusResourceGroupContext", "2022-01-01"), + new Tuple("DataProtection", "RecoveryPoints", "2022-01-01"), + new Tuple("DataProtection", "ResourceGuards", "2022-01-01"), + new Tuple("DataProtection", "RestorableTimeRanges", "2022-01-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.3.2"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/dataprotection/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=D:\\SDK_DPP\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "b49af808cba06f45b01193623ce1ff9e2e017777"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -