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:
parent
2ce3f962c7
commit
fce2677198
2 changed files with 39 additions and 0 deletions
|
@ -19,6 +19,7 @@ module Fog
|
||||||
request :list_volumes
|
request :list_volumes
|
||||||
|
|
||||||
request :create_snapshot
|
request :create_snapshot
|
||||||
|
request :delete_snapshot
|
||||||
request :list_snapshots
|
request :list_snapshots
|
||||||
request :get_snapshot_details
|
request :get_snapshot_details
|
||||||
|
|
||||||
|
|
38
lib/fog/hp/requests/block_storage/delete_snapshot.rb
Normal file
38
lib/fog/hp/requests/block_storage/delete_snapshot.rb
Normal 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
|
Loading…
Add table
Reference in a new issue