Class: Fog::AWS::EC2::Image

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

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods inherited from Model

#collection, #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



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/aws/models/ec2/image.rb', line 25

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

  if(delete_snapshot && @root_device_type=="ebs")
    @block_device_mapping.each do |block_device|
      next if block_device["deviceName"] != @root_device_name
      snapshot_id = block_device["snapshotId"]
      snapshot = @connection.snapshots.get(snapshot_id)
      return snapshot.destroy
    end
  end

  return true
end