1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add a delete_snapshot request method, a corresponding mock, and add support for it in the block storage provider.

This commit is contained in:
Rupak Ganguly 2012-08-02 19:12:54 -04:00
parent 2ce3f962c7
commit fce2677198
2 changed files with 39 additions and 0 deletions

View file

@ -19,6 +19,7 @@ module Fog
request :list_volumes
request :create_snapshot
request :delete_snapshot
request :list_snapshots
request :get_snapshot_details

View file

@ -0,0 +1,38 @@
module Fog
module BlockStorage
class HP
class Real
# Delete an existing block storage snapshot
#
# ==== Parameters
# * snapshot_id<~Integer> - Id of the snapshot to delete
#
def delete_snapshot(snapshot_id)
response = request(
:expects => 202,
:method => 'DELETE',
:path => "os-snapshots/#{snapshot_id}"
)
response
end
end
class Mock # :nodoc:all
def delete_snapshot(snapshot_id)
response = Excon::Response.new
if self.data[:snapshots][snapshot_id]
self.data[:snapshots].delete(snapshot_id)
response.status = 202
else
raise Fog::BlockStorage::HP::NotFound
end
response
end
end
end
end
end