mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add delete_volumes request method for block storage.
This commit is contained in:
parent
38bb493f04
commit
60e0f34d16
2 changed files with 38 additions and 1 deletions
|
@ -14,7 +14,7 @@ module Fog
|
|||
|
||||
request_path 'fog/hp/requests/block_storage'
|
||||
#request :create_volume
|
||||
#request :delete_volume
|
||||
request :delete_volume
|
||||
request :get_volume_details
|
||||
request :list_volumes
|
||||
|
||||
|
|
37
lib/fog/hp/requests/block_storage/delete_volume.rb
Normal file
37
lib/fog/hp/requests/block_storage/delete_volume.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
class Real
|
||||
|
||||
# Delete an existing block storage volume
|
||||
#
|
||||
# ==== Parameters
|
||||
# * volume_id<~Integer> - Id of the volume to delete
|
||||
#
|
||||
def delete_volume(volume_id)
|
||||
response = request(
|
||||
:expects => 202,
|
||||
:method => 'DELETE',
|
||||
:path => "os-volumes/#{volume_id}"
|
||||
)
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock # :nodoc:all
|
||||
|
||||
def delete_volume(volume_id)
|
||||
response = Excon::Response.new
|
||||
if volume = self.data[:volumes][volume_id]
|
||||
response.status = 202
|
||||
else
|
||||
raise Fog::BlockStorage::HP::NotFound
|
||||
end
|
||||
response
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue