/// <summary>
 /// The Delete Data Disk operation removes the specified data disk from
 /// a virtual machine.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157179.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 delete the data disk from.
 /// </param>
 /// <param name='logicalUnitNumber'>
 /// The logical unit number of the disk.
 /// </param>
 /// <param name='deleteFromStorage'>
 /// Optional. Specifies that the source blob for the disk should also
 /// be deleted from storage.
 /// </param>
 /// <returns>
 /// The response body contains the status of the specified asynchronous
 /// operation, indicating whether it has succeeded, is inprogress, or
 /// has failed. Note that this status is distinct from the HTTP status
 /// code returned for the Get Operation Status operation itself.  If
 /// the asynchronous operation succeeded, the response body includes
 /// the HTTP status code for the successful request.  If the
 /// asynchronous operation failed, the response body includes the HTTP
 /// status code for the failed request, and also includes error
 /// information regarding the failure.
 /// </returns>
 public static ComputeOperationStatusResponse DeleteDataDisk(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber, bool deleteFromStorage)
 {
     try
     {
         return(operations.DeleteDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, deleteFromStorage).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// The Delete Data Disk operation removes the specified data disk from
 /// a virtual machine.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157179.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 delete the data disk from.
 /// </param>
 /// <param name='logicalUnitNumber'>
 /// Required. The logical unit number of the disk.
 /// </param>
 /// <param name='deleteFromStorage'>
 /// Required. Specifies that the source blob for the disk should also
 /// be deleted from storage.
 /// </param>
 /// <returns>
 /// The response body contains the status of the specified asynchronous
 /// operation, indicating whether it has succeeded, is inprogress, or
 /// has failed. Note that this status is distinct from the HTTP status
 /// code returned for the Get Operation Status operation itself. If
 /// the asynchronous operation succeeded, the response body includes
 /// the HTTP status code for the successful request. If the
 /// asynchronous operation failed, the response body includes the HTTP
 /// status code for the failed request and error information regarding
 /// the failure.
 /// </returns>
 public static Task <OperationStatusResponse> DeleteDataDiskAsync(this IVirtualMachineDiskOperations operations, string serviceName, string deploymentName, string roleName, int logicalUnitNumber, bool deleteFromStorage)
 {
     return(operations.DeleteDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, deleteFromStorage, CancellationToken.None));
 }