Class: Fog::AWS::Compute::Images

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/compute/images.rb

Instance Attribute Summary

Attributes inherited from Collection

#connection

Instance Method Summary collapse

Methods inherited from Collection

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

Methods included from Fog::Attributes::ClassMethods

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

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

#initialize(attributes) ⇒ Images

Returns a new instance of Images.



14
15
16
17
# File 'lib/fog/aws/models/compute/images.rb', line 14

def initialize(attributes)
  @image_id ||= []
  super
end

Instance Method Details

#all(image_id = @image_id) ⇒ Object



19
20
21
22
23
# File 'lib/fog/aws/models/compute/images.rb', line 19

def all(image_id = @image_id)
  @image_id = image_id
  data = connection.describe_images('ImageId' => image_id).body
  load(data['imagesSet'])
end

#get(image_id) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fog/aws/models/compute/images.rb', line 25

def get(image_id)
  if image_id
    all(image_id).first
  end
rescue Fog::Errors::NotFound
  nil
end