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:
parent
25be8d0a3b
commit
e6eba51319
1 changed files with 35 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue