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

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

Instance Attribute Summary

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #destroy, #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 Attributes::InstanceMethods

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

Constructor Details

#initialize(attributes) ⇒ Images

Creates a new Amazon machine image

AWS.images.new

Returns

Returns the details of the new image

>> AWS.images.new

<Fog::AWS::Compute::Image
  id=nil,
  architecture=nil,
  block_device_mapping=nil,
  location=nil,
  owner_id=nil,
  state=nil,
  type=nil,
  is_public=nil,
  kernel_id=nil,
  platform=nil,
  product_codes=nil,
  ramdisk_id=nil,
  root_device_type=nil,
  root_device_name=nil,
  tags=nil
>


42
43
44
45
# File 'lib/rackspace-fog/aws/models/compute/images.rb', line 42

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object



47
48
49
50
51
# File 'lib/rackspace-fog/aws/models/compute/images.rb', line 47

def all(filters = filters)
  self.filters = filters
  data = connection.describe_images(filters).body
  load(data['imagesSet'])
end

#get(image_id) ⇒ Object



53
54
55
56
57
# File 'lib/rackspace-fog/aws/models/compute/images.rb', line 53

def get(image_id)
  if image_id
    self.class.new(:connection => connection).all('image-id' => image_id).first
  end
end