1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Update images.rb

This commit is contained in:
dJason 2013-08-21 11:30:14 -06:00
parent 25be8d0a3b
commit e6eba51319

View file

@ -6,6 +6,30 @@ module Fog
class RackspaceV2 class RackspaceV2
class Images < Fog::Collection class Images < Fog::Collection
# @!attribute [rw] name
# @return [String] Given a string value x, filters the list of images by image name.
attribute :name
# @!attribute [rw] status
# @return [String] Given a string value x, filters the list of images by status.
# @note Possible values are ACTIVE, DELETED, ERROR, SAVING, and UNKNOWN.
attribute :status
# @!attribute [rw] marker
# @return [String] Given a string value x, return object names greater in value than the specified marker.
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Large_Number_of_Objects-d1e1521.html
attribute :marker
# @!attribute [rw] limit
# @return [Integer] For an integer value n, limits the number of results to at most n values.
# @see http://docs.rackspace.com/files/api/v1/cf-devguide/content/List_Large_Number_of_Objects-d1e1521.html
attribute :limit
# @!attribute [rw] type
# @return [String] Given a string value x, filters the list of images by type.
# @note Valid values are BASE and SNAPSHOT
attribute :type
model Fog::Compute::RackspaceV2::Image model Fog::Compute::RackspaceV2::Image
# Returns list of images # Returns list of images
@ -17,8 +41,17 @@ module Fog
# @note Fog's current implementation only returns 1000 images. # @note Fog's current implementation only returns 1000 images.
# @note Fog does not retrieve all image details. Please use get to retrieve all details for a specific image. # @note Fog does not retrieve all image details. Please use get to retrieve all details for a specific image.
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html
def all def all(options = {})
data = service.list_images.body['images'] options = {
'name' => name,
'status' => status,
'marker' => marker,
'limit' => limit,
'type' => type
}.merge!(options)
merge_attributes(options)
# TODO look at storage/get_container.rb on how to merge options
data = service.list_images(options).body['images']
load(data) load(data)
end end