/// <summary>
 /// Get the Site object by Id.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.ISiteOperations.
 /// </param>
 /// <param name='input'>
 /// Required. Site Creation Input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The response model for the Job details object.
 /// </returns>
 public static JobResponse Create(this ISiteOperations operations, SiteCreationInput input, CustomRequestHeaders customRequestHeaders)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((ISiteOperations)s).CreateAsync(input, customRequestHeaders);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        public void CreateSiteTest()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var client = GetSiteRecoveryClient(CustomHttpHandler);
                var responseSite = client.Sites.List(RequestHeaders);
                SiteCreationInput input = new SiteCreationInput();
                input.Name = "TestSite123_HyperVSite";
                input.FabricType = "HyperVSite";
                var response = client.Sites.Create(
                    input, 
                    RequestHeaders);

                Assert.NotNull(response.Job);
                Assert.NotNull(response.Job.ID);
                Assert.NotNull(response.Job.Name);
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
        /// <summary>
        /// Method to create a Site
        /// </summary>
        /// <param name="siteName">name of the site</param>
        /// <param name="siteType">type of the site</param>
        /// <param name="vault">vault object</param>
        /// <returns>job object for the creation.</returns>
        public JobResponse CreateAzureSiteRecoverySite(string siteName, string siteType = null, ASRVault vault = null)
        {
            if (vault != null)
            {
                Utilities.UpdateVaultSettings(new ASRVaultCreds()
                {
                    CloudServiceName = vault.CloudServiceName,
                    ResourceName = vault.Name
                });
            }

            if (string.IsNullOrEmpty(siteType))
            {
                siteType = FabricProviders.HyperVSite;
            }

            SiteCreationInput input = new SiteCreationInput()
            {
                Name = siteName,
                FabricType = siteType
            };

            return this.GetSiteRecoveryClient().Sites.Create(input, this.GetRequestHeaders(false));
        }
 /// <summary>
 /// Get the Site object by Id.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.ISiteOperations.
 /// </param>
 /// <param name='input'>
 /// Required. Site Creation Input.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The response model for the Job details object.
 /// </returns>
 public static Task<JobResponse> CreateAsync(this ISiteOperations operations, SiteCreationInput input, CustomRequestHeaders customRequestHeaders)
 {
     return operations.CreateAsync(input, customRequestHeaders, CancellationToken.None);
 }