/// <summary>
 /// Creates a vault
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecoveryVault.IVaultOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the (resource group?) cloud service
 /// containing the job collection.
 /// </param>
 /// <param name='vaultName'>
 /// Required. The name of the vault to create.
 /// </param>
 /// <param name='vaultCreationInput'>
 /// Required. Vault object to be created
 /// </param>
 /// <returns>
 /// The response model for the Vm group object.
 /// </returns>
 public static VaultCreateResponse BeginCreating(this IVaultOperations operations, string resourceGroupName, string vaultName, VaultCreateArgs vaultCreationInput)
 {
     return Task.Factory.StartNew((object s) =>
     {
         return ((IVaultOperations)s).BeginCreatingAsync(resourceGroupName, vaultName, vaultCreationInput);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteSiteRecoveryCmdlet()
        {
            base.ExecuteSiteRecoveryCmdlet();

            this.WriteWarningWithTimestamp(
                string.Format(
                Properties.Resources.SiteRecoveryVaultTypeWillBeDeprecatedSoon));

            VaultCreateArgs vaultCreateArgs = new VaultCreateArgs();
            vaultCreateArgs.Location = this.Location;
            vaultCreateArgs.Properties = new VaultProperties();
            vaultCreateArgs.Properties.Sku = new VaultSku();
            vaultCreateArgs.Properties.Sku.Name = "standard";

            VaultCreateResponse response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs);

            this.WriteObject(new ASRVault(response));
        }
        public void CreateVault()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var rsmClient = GetRecoveryServicesClient(CustomHttpHandler);
                VaultCreateArgs vaultCreateArgs= new VaultCreateArgs();
                vaultCreateArgs.Location = "westus";
                vaultCreateArgs.Properties = new VaultProperties();
                vaultCreateArgs.Properties.Sku = new VaultSku();
                vaultCreateArgs.Properties.Sku.Name = "standard";
                VaultCreateResponse response = rsmClient.Vaults.BeginCreating(resourceGroupName, resourceName, vaultCreateArgs);

                Assert.NotNull(response.Name);
                Assert.NotNull(response.Id);
                Assert.NotNull(response.Properties.ProvisioningState);
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
            }
        }
 /// <summary>
 /// Method to create Azure Site Recovery Vault
 /// </summary>
 /// <param name="resouceGroupName">name of the resouce group</param>
 /// <param name="vaultName">name of the vault</param>
 /// <param name="vaultCreateInput">vault creation input object</param>
 /// <returns>creation response object.</returns>
 public VaultCreateResponse CreateVault(string resouceGroupName, string vaultName, VaultCreateArgs vaultCreateInput)
 {
     return this.recoveryServicesClient.Vaults.BeginCreating(resouceGroupName, vaultName, vaultCreateInput);
 }
 /// <summary>
 /// Creates a vault
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecoveryVault.IVaultOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the (resource group?) cloud service
 /// containing the job collection.
 /// </param>
 /// <param name='vaultName'>
 /// Required. The name of the vault to create.
 /// </param>
 /// <param name='vaultCreationInput'>
 /// Required. Vault object to be created
 /// </param>
 /// <returns>
 /// The response model for the Vm group object.
 /// </returns>
 public static Task<VaultCreateResponse> BeginCreatingAsync(this IVaultOperations operations, string resourceGroupName, string vaultName, VaultCreateArgs vaultCreationInput)
 {
     return operations.BeginCreatingAsync(resourceGroupName, vaultName, vaultCreationInput, CancellationToken.None);
 }
 /// <summary>
 /// Creates a vault
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.SiteRecoveryVault.IVaultOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the (resource group) cloud service containing
 /// the job collection.
 /// </param>
 /// <param name='vaultName'>
 /// Optional. The name of the vault to create.
 /// </param>
 /// <param name='vaultCreationInput'>
 /// Required. Vault object to be created
 /// </param>
 /// <returns>
 /// The response body contains the status of the specified asynchronous
 /// operation, indicating whether it has succeeded, is inprogress, or
 /// has failed. Note that this status is distinct from the HTTP status
 /// code returned for the Get Operation Status operation itself.  If
 /// the asynchronous operation succeeded, the response body includes
 /// the HTTP status code for the successful request.  If the
 /// asynchronous operation failed, the response body includes the HTTP
 /// status code for the failed request, and also includes error
 /// information regarding the failure.
 /// </returns>
 public static Task<RecoveryServicesOperationStatusResponse> CreateAsync(this IVaultOperations operations, string resourceGroupName, string vaultName, VaultCreateArgs vaultCreationInput)
 {
     return operations.CreateAsync(resourceGroupName, vaultName, vaultCreationInput, CancellationToken.None);
 }