Class: Fog::Compute::RackspaceV2::Images

Inherits:
Fog::Collection show all
Defined in:
lib/fog/rackspace/models/compute_v2/images.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#service

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allArray<Fog::Compute::RackspaceV2::Image>

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.

Returns list of images



16
17
18
19
# File 'lib/fog/rackspace/models/compute_v2/images.rb', line 16

def all
  data = service.list_images.body['images']
  load(data)
end

#get(image_id) ⇒ Fog::Compute::RackspaceV2:Image

Retrieve image

Parameters:

  • image_id (String)

    id of image

Returns:

  • (Fog::Compute::RackspaceV2:Image)

    image

See Also:



25
26
27
28
29
30
# File 'lib/fog/rackspace/models/compute_v2/images.rb', line 25

def get(image_id)
  data = service.get_image(image_id).body['image']
  new(data)
rescue Fog::Compute::RackspaceV2::NotFound
  nil
end