/// <summary> /// The Delete Disk operation deletes the specified data or operating /// system disk from your image repository. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157200.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 to delete. /// </param> /// <param name='deleteFromStorage'> /// Optional. Specifies that the source blob for the disk should also /// be deleted from storage. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse DeleteDisk(this IVirtualMachineDiskOperations operations, string name, bool deleteFromStorage) { try { return(operations.DeleteDiskAsync(name, deleteFromStorage).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// The Delete Disk operation deletes the specified data or operating /// system disk from your image repository. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj157200.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 to delete. /// </param> /// <param name='deleteFromStorage'> /// Required. Specifies that the source blob for the disk should also /// be deleted from storage. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task <AzureOperationResponse> DeleteDiskAsync(this IVirtualMachineDiskOperations operations, string name, bool deleteFromStorage) { return(operations.DeleteDiskAsync(name, deleteFromStorage, CancellationToken.None)); }