/// <summary>
 /// The Get Disk operation retrieves a disk from the user image
 /// repository. The disk can be an operating system disk or a data
 /// disk.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157178.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations.
 /// </param>
 /// <param name='name'>
 /// The name of the disk.
 /// </param>
 /// <returns>
 /// A virtual machine disk associated with your subscription.
 /// </returns>
 public static VirtualMachineDiskGetResponse GetDisk(this IVirtualMachineDiskOperations operations, string name)
 {
     try
     {
         return(operations.GetDiskAsync(name).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// The Get Disk operation retrieves a disk from the user image
 /// repository. The disk can be an operating system disk or a data
 /// disk.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157178.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineDiskOperations.
 /// </param>
 /// <param name='name'>
 /// Required. The name of the disk.
 /// </param>
 /// <returns>
 /// A virtual machine disk associated with your subscription.
 /// </returns>
 public static Task <VirtualMachineDiskGetResponse> GetDiskAsync(this IVirtualMachineDiskOperations operations, string name)
 {
     return(operations.GetDiskAsync(name, CancellationToken.None));
 }