/// <summary> /// The Get Data Disk operation retrieves the specified data disk from /// a virtual machine. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157180.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. /// </param> /// <param name='logicalUnitNumber'> /// The logical unit number of the disk. /// </param> /// <returns> /// The Get Data Disk operation response. /// </returns> public static VirtualMachineDataDiskGetResponse GetDataDisk(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber) { try { return(operations.GetDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// The Get Data Disk operation retrieves the specified data disk from /// a virtual machine. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157180.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. /// </param> /// <param name='logicalUnitNumber'> /// Required. The logical unit number of the disk. /// </param> /// <returns> /// The Get Data Disk operation response. /// </returns> public static Task <VirtualMachineDataDiskGetResponse> GetDataDiskAsync(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber) { return(operations.GetDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, CancellationToken.None)); }