public void ExecuteCommand() { var parameters = new VirtualMachineImageCreateParameters { Name = this.ImageName, MediaLinkUri = new Uri(this.MediaLocation), Label = string.IsNullOrEmpty(this.Label) ? this.ImageName : this.Label, OperatingSystemType = this.OS, Eula = this.Eula, Description = this.Description, ImageFamily = this.ImageFamily, PublishedDate = this.PublishedDate, PrivacyUri = this.PrivacyUri, RecommendedVMSize = this.RecommendedVMSize }; this.ExecuteClientActionNewSM( null, this.CommandRuntime.ToString(), () => this.ComputeClient.VirtualMachineImages.Create(parameters), (s, response) => this.ContextFactory<VirtualMachineImageCreateResponse, OSImageContext>(response, s)); }
public void ExecuteCommand() { var parameters = new VirtualMachineImageCreateParameters { Name = this.ImageName, MediaLinkUri = new Uri(this.MediaLocation), Label = string.IsNullOrEmpty(this.Label) ? this.ImageName : this.Label, OperatingSystemType = this.OS, Eula = this.Eula, Description = this.Description, ImageFamily = this.ImageFamily, PublishedDate = this.PublishedDate, PrivacyUri = this.PrivacyUri, RecommendedVMSize = this.RecommendedVMSize }; this.ExecuteClientActionNewSM( null, this.CommandRuntime.ToString(), () => this.ComputeClient.VirtualMachineImages.Create(parameters), (s, response) => this.ContextFactory <VirtualMachineImageCreateResponse, OSImageContext>(response, s)); }
/// <summary> /// The Add OS Image operation adds an operating system image that is /// stored in a storage account and is available from the image /// repository. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157192.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineImageOperations. /// </param> /// <param name='parameters'> /// Parameters supplied to the Create Virtual Machine Image operation. /// </param> /// <returns> /// Parameters returned from the Create Virtual Machine Image operation. /// </returns> public static Task<VirtualMachineImageCreateResponse> CreateAsync(this IVirtualMachineImageOperations operations, VirtualMachineImageCreateParameters parameters) { return operations.CreateAsync(parameters, CancellationToken.None); }
/// <summary> /// The Add OS Image operation adds an operating system image that is /// stored in a storage account and is available from the image /// repository. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157192.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineImageOperations. /// </param> /// <param name='parameters'> /// Parameters supplied to the Create Virtual Machine Image operation. /// </param> /// <returns> /// Parameters returned from the Create Virtual Machine Image operation. /// </returns> public static VirtualMachineImageCreateResponse Create(this IVirtualMachineImageOperations operations, VirtualMachineImageCreateParameters parameters) { try { return operations.CreateAsync(parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }