From e6eba513190746b64753e6b553a924511b0b3bd5 Mon Sep 17 00:00:00 2001 From: dJason Date: Wed, 21 Aug 2013 11:30:14 -0600 Subject: [PATCH] Update images.rb --- lib/fog/rackspace/models/compute_v2/images.rb | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/fog/rackspace/models/compute_v2/images.rb b/lib/fog/rackspace/models/compute_v2/images.rb index 566a54781..832c52b35 100644 --- a/lib/fog/rackspace/models/compute_v2/images.rb +++ b/lib/fog/rackspace/models/compute_v2/images.rb @@ -5,6 +5,30 @@ module Fog module Compute class RackspaceV2 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 @@ -17,8 +41,17 @@ module Fog # @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. # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Images-d1e4435.html - def all - data = service.list_images.body['images'] + def all(options = {}) + 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) end