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

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

Instance Method Summary collapse

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
>


40
41
42
43
# File 'lib/fog/aws/models/compute/images.rb', line 40

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

Instance Method Details

#all(filters = filters) ⇒ Object



45
46
47
48
49
# File 'lib/fog/aws/models/compute/images.rb', line 45

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

#get(image_id) ⇒ Object



51
52
53
54
55
# File 'lib/fog/aws/models/compute/images.rb', line 51

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