/// <summary> /// Creates a Fabric /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations. /// </param> /// <param name='fabricName'> /// Required. Fabric Name. /// </param> /// <param name='input'> /// Required. Input to create fabric /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response for long running operations. /// </returns> public static LongRunningOperationResponse BeginCreating(this IFabricOperations operations, string fabricName, FabricCreationInput input, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { return ((IFabricOperations)s).BeginCreatingAsync(fabricName, input, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
public void CreateSite() { using (UndoContext context = UndoContext.Current) { context.Start(); var client = GetSiteRecoveryClient(CustomHttpHandler); FabricCreationInput siteInput = new FabricCreationInput(); siteInput.Properties = new FabricCreationInputProperties(); var site = client.Fabrics.Create(siteName, siteInput, RequestHeaders); var response = client.Fabrics.Get(siteName, RequestHeaders); Assert.True(response.Fabric.Name == siteName, "Site Name can not be different"); } }
public void A2ACreateSite() { using (UndoContext context = UndoContext.Current) { context.Start(); var client = GetSiteRecoveryClient(CustomHttpHandler, Constants.A2A); FabricCreationInput siteInput = new FabricCreationInput(); siteInput.Properties = new FabricCreationInputProperties(); siteInput.Properties.CustomDetails = new AzureFabricCreationInput() { Location = location }; var response = client.Fabrics.BeginCreating(azureSiteName, siteInput, RequestHeaders); Assert.NotNull(response); } }
/// <summary> /// Creates Azure Site Recovery Fabric. /// </summary> /// <param name="createAndAssociatePolicyInput">Policy Input</param> /// <returns>Long operation response</returns> public LongRunningOperationResponse CreateAzureSiteRecoveryFabric(string fabricName, string fabricType = null) { if (string.IsNullOrEmpty(fabricType)) { fabricType = FabricProviders.HyperVSite; } FabricCreationInputProperties fabricCreationInputProperties = new FabricCreationInputProperties() { FabricType = fabricType, }; FabricCreationInput fabricCreationInput = new FabricCreationInput() { Properties = fabricCreationInputProperties }; return this.GetSiteRecoveryClient().Fabrics.BeginCreating(fabricName, fabricCreationInput, this.GetRequestHeaders(false)); }
/// <summary> /// Creates a Fabric /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.SiteRecovery.IFabricOperations. /// </param> /// <param name='fabricName'> /// Required. Fabric Name. /// </param> /// <param name='input'> /// Required. Input to create fabric /// </param> /// <param name='customRequestHeaders'> /// Optional. Request header parameters. /// </param> /// <returns> /// A standard service response for long running operations. /// </returns> public static Task<LongRunningOperationResponse> BeginCreatingAsync(this IFabricOperations operations, string fabricName, FabricCreationInput input, CustomRequestHeaders customRequestHeaders) { return operations.BeginCreatingAsync(fabricName, input, customRequestHeaders, CancellationToken.None); }