2012-01-10 17:20:56 -05:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class IBM
|
|
|
|
class Real
|
2011-04-27 01:49:05 -04:00
|
|
|
# Clones image specified by image_id
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * image_id<~String> - id of image to be cloned
|
|
|
|
# * name<~String> - name of new image
|
|
|
|
# * description<~String> - description of new image
|
2012-01-10 17:20:56 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
2011-04-27 01:49:05 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'ImageID'<~String>: id of new image
|
2012-01-17 16:34:47 -05:00
|
|
|
def clone_image(image_id, name, description)
|
|
|
|
request(
|
2012-01-10 17:20:56 -05:00
|
|
|
:method => 'POST',
|
|
|
|
:expects => 200,
|
2012-01-17 16:34:47 -05:00
|
|
|
:path => "/offerings/image/#{image_id}",
|
|
|
|
:body => {
|
|
|
|
'name' => name,
|
|
|
|
'description' => description
|
|
|
|
}
|
|
|
|
)
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
end
|
2011-12-02 13:27:44 -05:00
|
|
|
class Mock
|
|
|
|
def clone_image(image_id, name, description)
|
|
|
|
response = Excon::Response.new
|
|
|
|
if image_exists? image_id
|
|
|
|
id = Fog::IBM::Mock.instance_id
|
2012-03-20 08:53:24 -04:00
|
|
|
self.data[:images][id] = self.data[:images][image_id].merge('id' => id, 'name' => name, 'description' => description)
|
2011-12-02 13:27:44 -05:00
|
|
|
response.status = 200
|
|
|
|
response.body = { "ImageID" => id }
|
|
|
|
else
|
|
|
|
response.status = 404
|
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
2012-01-10 17:20:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|