/// <summary> /// ProcessRecord of the command. /// </summary> public override void ExecuteCmdlet() { try { if (this.BackupStorageRedundancy.HasValue) { UpdateVaultStorageTypeRequest vaultStorageRequest = new UpdateVaultStorageTypeRequest(); vaultStorageRequest.Properties = new StorageTypeProperties(); vaultStorageRequest.Properties.StorageModelType = BackupStorageRedundancy.ToString(); AzureOperationResponse storageResponse = RecoveryServicesClient.UpdateVaultStorageType( this.Vault.ResourceGroupName, this.Vault.Name, vaultStorageRequest); } else { throw new Exception(Properties.Resources.NoBackupPropertiesProvided); } } catch (Exception exception) { this.HandleException(exception); } }
/// <summary> /// Method to Update Azure Recovery Services Vault Backup Properties /// </summary> /// <param name="resouceGroupName">Name of the resouce group</param> /// <param name="vaultName">Name of the vault</param> /// <param name="vaultStorageUpdateRequest">Backup Properties Update</param> /// <returns>Azure Operation response object.</returns> public AzureOperationResponse UpdateVaultStorageType(string resouceGroupName, string vaultName, UpdateVaultStorageTypeRequest vaultStorageUpdateRequest) { return this.recoveryServicesClient.Vaults.UpdateStorageType(resouceGroupName, vaultName, vaultStorageUpdateRequest, this.GetRequestHeaders()); }
/// <summary> /// Updates vault storage model type. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.RecoveryServices.IVaultOperations. /// </param> /// <param name='resourceGroupName'> /// Required. /// </param> /// <param name='resourceName'> /// Required. /// </param> /// <param name='updateVaultStorageTypeRequest'> /// Required. Update Vault Storage Type Request /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<AzureOperationResponse> UpdateStorageTypeAsync(this IVaultOperations operations, string resourceGroupName, string resourceName, UpdateVaultStorageTypeRequest updateVaultStorageTypeRequest, CustomRequestHeaders customRequestHeaders) { return operations.UpdateStorageTypeAsync(resourceGroupName, resourceName, updateVaultStorageTypeRequest, customRequestHeaders, CancellationToken.None); }
/// <summary> /// Updates vault storage model type. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.RecoveryServices.IVaultOperations. /// </param> /// <param name='resourceGroupName'> /// Required. /// </param> /// <param name='resourceName'> /// Required. /// </param> /// <param name='updateVaultStorageTypeRequest'> /// Required. Update Vault Storage Type Request /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static AzureOperationResponse UpdateStorageType(this IVaultOperations operations, string resourceGroupName, string resourceName, UpdateVaultStorageTypeRequest updateVaultStorageTypeRequest, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { return ((IVaultOperations)s).UpdateStorageTypeAsync(resourceGroupName, resourceName, updateVaultStorageTypeRequest, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }