2009-09-12 14:58:05 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
|
|
|
|
|
|
|
# Describe all or specified images.
|
|
|
|
#
|
|
|
|
# ==== Params
|
|
|
|
# * options<~Hash> - Optional params
|
|
|
|
# * 'ExecutableBy'<~String> - Only return images that the executable_by
|
|
|
|
# user has explicit permission to launch
|
|
|
|
# * 'ImageId'<~Array> - Ids of images to describe
|
|
|
|
# * 'Owner'<~String> - Only return images belonging to owner.
|
|
|
|
#
|
|
|
|
# ==== Returns
|
2009-11-02 21:48:49 -05:00
|
|
|
# * response<~Excon::Response>:
|
2009-09-12 14:58:05 -04:00
|
|
|
# * body<~Hash>:
|
|
|
|
# * 'requestId'<~String> - Id of request
|
|
|
|
# * 'imagesSet'<~Array>:
|
|
|
|
# * 'architecture'<~String> - Architecture of the image
|
|
|
|
# * 'imageId'<~String> - Id of the image
|
|
|
|
# * 'imageLocation'<~String> - Location of the image
|
|
|
|
# * 'imageOwnerId'<~String> - Id of the owner of the image
|
|
|
|
# * 'imageState'<~String> - State of the image
|
|
|
|
# * 'imageType'<~String> - Type of the image
|
|
|
|
# * 'isPublic'<~Boolean> - Whether or not the image is public
|
|
|
|
# * 'kernelId'<~String> - Kernel id associated with image, if any
|
|
|
|
# * 'platform'<~String> - Operating platform of the image
|
|
|
|
# * 'productCodes'<~Array> - Product codes for the image
|
|
|
|
# * 'ramdiskId'<~String> - Ramdisk id associated with image, if any
|
|
|
|
def describe_images(options = {})
|
|
|
|
if image_id = options.delete('ImageId')
|
|
|
|
options.merge!(indexed_params('ImageId', image_id))
|
|
|
|
end
|
|
|
|
request({
|
|
|
|
'Action' => 'DescribeImages'
|
|
|
|
}.merge!(options), Fog::Parsers::AWS::EC2::DescribeImages.new)
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
2009-09-12 14:58:05 -04:00
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
2009-09-12 14:58:05 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class EC2
|
2009-07-13 22:14:59 -04:00
|
|
|
|
2009-09-12 14:58:05 -04:00
|
|
|
def describe_images(options = {})
|
|
|
|
response = Fog::Response.new
|
|
|
|
images = []
|
|
|
|
|
|
|
|
(rand(101 + 100)).times do
|
|
|
|
images << Fog::AWS::Mock.image
|
|
|
|
end
|
|
|
|
|
|
|
|
response.status = 200
|
|
|
|
response.body = {
|
|
|
|
'requestId' => Fog::AWS::Mock.request_id,
|
|
|
|
'imagesSet' => images
|
|
|
|
}
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
2009-09-12 14:58:05 -04:00
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|