/// <summary> /// The Create Affinity Group operation creates a new affinity group /// for the specified subscription. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/gg715317.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.IAffinityGroupOperations. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Create Affinity Group /// operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static AzureOperationResponse Create(this IAffinityGroupOperations operations, AffinityGroupCreateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IAffinityGroupOperations)s).CreateAsync(parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Create affinity group /// </summary> /// <param name="input"></param> public void CreateAffinityGroup(AffinityGroupCreateParameters input) { TestEasyLog.Instance.Info(string.Format("Creating affinity group '{0}'", input.Name)); ManagementClient.AffinityGroups.CreateAsync(input, new CancellationToken()).Wait(); Dependencies.TestResourcesCollector.Remember(AzureResourceType.AffinityGroup, input.Name, input.Name); }
/// <summary> /// The Create Affinity Group operation creates a new affinity group /// for the specified subscription. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/gg715317.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.IAffinityGroupOperations. /// </param> /// <param name='parameters'> /// Parameters supplied to the Create Affinity Group operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse Create(this IAffinityGroupOperations operations, AffinityGroupCreateParameters parameters) { try { return operations.CreateAsync(parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
public void ExecuteCommand() { ServiceManagementProfile.Initialize(); if (string.IsNullOrEmpty(Label)) { Label = Name; } var input = new AffinityGroupCreateParameters { Description = this.Description, Label = this.Label, Location = this.Location, Name = this.Name }; ExecuteClientActionNewSM( null, CommandRuntime.ToString(), () => this.ManagementClient.AffinityGroups.Create(input)); }
/// <summary> /// The Create Affinity Group operation creates a new affinity group /// for the specified subscription. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/gg715317.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.IAffinityGroupOperations. /// </param> /// <param name='parameters'> /// Parameters supplied to the Create Affinity Group operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<OperationResponse> CreateAsync(this IAffinityGroupOperations operations, AffinityGroupCreateParameters parameters) { return operations.CreateAsync(parameters, CancellationToken.None); }