Class: Fog::AWS::Compute::Image

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

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

This class inherits a constructor from Fog::Model

Instance Method Details

#deregister(delete_snapshot = false) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/compute/models/aws/image.rb', line 28

def deregister(delete_snapshot = false)
  connection.deregister_image(id)

  if(delete_snapshot && root_device_type == "ebs")
    block_device = block_device_mapping.detect {|block_device| block_device['deviceName'] == root_device_name}
    @connection.snapshots.new(:id => block_device['snapshotId']).destroy
  else
    true
  end
end