2010-03-16 18:46:21 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
module EC2
|
|
|
|
class Real
|
2009-08-15 18:19:07 -04:00
|
|
|
|
|
|
|
# Delete an EBS volume
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * volume_id<~String> - Id of volume to delete.
|
|
|
|
#
|
|
|
|
# ==== Returns
|
2009-11-02 21:48:49 -05:00
|
|
|
# * response<~Excon::Response>:
|
2009-08-15 18:19:07 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'requestId'<~String> - Id of request
|
|
|
|
# * 'return'<~Boolean> - success?
|
|
|
|
def delete_volume(volume_id)
|
2010-03-16 01:15:33 -04:00
|
|
|
request(
|
|
|
|
'Action' => 'DeleteVolume',
|
|
|
|
'VolumeId' => volume_id,
|
|
|
|
:parser => Fog::Parsers::AWS::EC2::Basic.new
|
|
|
|
)
|
2009-08-15 18:19:07 -04:00
|
|
|
end
|
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
|
2010-03-16 18:46:21 -04:00
|
|
|
class Mock
|
2009-08-15 18:19:07 -04:00
|
|
|
|
|
|
|
def delete_volume(volume_id)
|
2009-11-20 14:08:08 -05:00
|
|
|
response = Excon::Response.new
|
2010-03-16 18:46:21 -04:00
|
|
|
if volume = @data[:volumes][volume_id]
|
|
|
|
@data[:deleted_at][volume_id] = Time.now
|
2009-08-15 18:19:07 -04:00
|
|
|
volume['status'] = 'deleting'
|
|
|
|
response.status = 200
|
|
|
|
response.body = {
|
|
|
|
'requestId' => Fog::AWS::Mock.request_id,
|
2009-08-20 22:25:52 -04:00
|
|
|
'return' => true
|
2009-08-15 18:19:07 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
response.status = 400
|
2009-11-20 14:08:08 -05:00
|
|
|
raise(Excon::Errors.status_error({:expects => 200}, response))
|
2009-08-15 18:19:07 -04:00
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|