/// <summary> /// The Update Data Disk operation updates the specified data disk /// attached to the specified virtual machine. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157190.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations. /// </param> /// <param name='serviceName'> /// Required. The name of your service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='roleName'> /// Required. The name of the role to add the data disk to. /// </param> /// <param name='logicalUnitNumber'> /// Required. The logical unit number of the disk. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update Virtual Machine Data /// Disk operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<OperationResponse> UpdateDataDiskAsync(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber, VirtualMachineDataDiskUpdateParameters parameters) { return operations.UpdateDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, parameters, CancellationToken.None); }
/// <summary> /// The Update Data Disk operation updates the specified data disk /// attached to the specified virtual machine. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157190.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations. /// </param> /// <param name='serviceName'> /// The name of your service. /// </param> /// <param name='deploymentName'> /// The name of the deployment. /// </param> /// <param name='roleName'> /// The name of the role to add the data disk to. /// </param> /// <param name='logicalUnitNumber'> /// The logical unit number of the disk. /// </param> /// <param name='parameters'> /// Parameters supplied to the Update Virtual Machine Data Disk /// operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse UpdateDataDisk(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber, VirtualMachineDataDiskUpdateParameters parameters) { try { return operations.UpdateDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// The Update Data Disk operation updates the specified data disk /// attached to the specified virtual machine. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157190.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations. /// </param> /// <param name='serviceName'> /// Required. The name of your service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='roleName'> /// Required. The name of the role to add the data disk to. /// </param> /// <param name='logicalUnitNumber'> /// Required. The logical unit number of the disk. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update Virtual Machine Data /// Disk operation. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse UpdateDataDisk(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber, VirtualMachineDataDiskUpdateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IVirtualMachineDiskOperations)s).UpdateDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
protected PSArgument[] CreateVirtualMachineDiskUpdateDataDiskParameters() { string serviceName = string.Empty; string deploymentName = string.Empty; string roleName = string.Empty; int logicalUnitNumber = new int(); VirtualMachineDataDiskUpdateParameters parameters = new VirtualMachineDataDiskUpdateParameters(); return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentName", "RoleName", "LogicalUnitNumber", "Parameters" }, new object[] { serviceName, deploymentName, roleName, logicalUnitNumber, parameters }); }