1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/ibm/requests/compute/delete_image.rb

44 lines
1.1 KiB
Ruby
Raw Normal View History

2012-01-10 17:20:56 -05:00
module Fog
module Compute
class IBM
class Real
2011-04-27 01:49:05 -04:00
# Deletes the image that the authenticated user manages with the specified :image_id
#
# ==== Parameters
# * image_id<~String> - Id of image
2012-01-10 17:20:56 -05:00
#
# ==== Returns
# * response<~Excon::Response>:
2011-04-27 01:49:05 -04:00
# * body<~Hash>:
# *'success'<~Bool>: true or false for success
2012-01-10 17:20:56 -05:00
def delete_image(image_id)
request(
:method => 'DELETE',
:expects => 200,
:path => "/offerings/image/#{image_id}"
)
end
end
2011-12-02 13:27:44 -05:00
class Mock
def delete_image(image_id)
response = Excon::Response.new
# TODO: We should probably check that an image is deleteable.
# i.e. that the user has appropriate permissions
if image_exists? image_id
self.data[:images].delete image_id
response.status = 200
response.body = {"success"=>true}
else
response.status = 404
end
response
end
end
2012-01-10 17:20:56 -05:00
end
end
end