lib/fog/azurerm/requests/compute/delete_managed_disk.rb in far-gem-0.5.1 vs lib/fog/azurerm/requests/compute/delete_managed_disk.rb in far-gem-0.5.2
- old
+ new
@@ -2,19 +2,27 @@
module Fog
module Compute
class AzureRM
# Real class for Compute Request
class Real
- def delete_managed_disk(resource_group_name, disk_name)
+ def delete_managed_disk(resource_group_name, disk_name, async)
msg = "Deleting Managed Disk: #{disk_name}"
Fog::Logger.debug msg
begin
- @compute_mgmt_client.disks.delete(resource_group_name, disk_name)
+ if async
+ response = @compute_mgmt_client.disks.delete_async(resource_group_name, disk_name)
+ else
+ @compute_mgmt_client.disks.delete(resource_group_name, disk_name)
+ end
rescue MsRestAzure::AzureOperationError => e
raise_azure_exception(e, msg)
end
- Fog::Logger.debug "Managed Disk #{disk_name} deleted successfully."
- true
+ if async
+ response
+ else
+ Fog::Logger.debug "Managed Disk #{disk_name} deleted successfully."
+ true
+ end
end
end
# Mock class for Compute Request
class Mock