Sha256: d62ca48ba71c360f207716a960c8b6c14da44d11e2847e4df7a14900b01ad282

Contents?: true

Size: 1.54 KB

Versions: 15

Compression:

Stored size: 1.54 KB

Contents

require 'fog/core/model'

module Fog
  module AWS
    class Compute

      class Image < Fog::Model

        identity :id,                     :aliases => 'imageId'

        attribute :architecture
        attribute :block_device_mapping,  :aliases => 'blockDeviceMapping'
        attribute :location,              :aliases => 'imageLocation'
        attribute :owner_id,              :aliases => 'imageOwnerId'
        attribute :state,                 :aliases => 'imageState'
        attribute :type,                  :aliases => 'imageType'
        attribute :is_public,             :aliases => 'isPublic'
        attribute :kernel_id,             :aliases => 'kernelId'
        attribute :platform
        attribute :product_codes,         :aliases => 'productCodes'
        attribute :ramdisk_id,            :aliases => 'ramdiskId'
        attribute :root_device_type,      :aliases => 'rootDeviceType'
        attribute :root_device_name,      :aliases => 'rootDeviceName'
        attribute :tags,                  :aliases => 'tagSet'

        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

      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fog-0.3.22 lib/fog/aws/models/compute/image.rb
fog-0.3.21 lib/fog/aws/models/compute/image.rb
fog-0.3.20 lib/fog/aws/models/compute/image.rb
fog-0.3.19 lib/fog/aws/models/compute/image.rb
fog-0.3.18 lib/fog/aws/models/compute/image.rb
fog-0.3.17 lib/fog/aws/models/compute/image.rb
fog-0.3.16 lib/fog/aws/models/compute/image.rb
fog-0.3.15 lib/fog/aws/models/compute/image.rb
fog-0.3.14 lib/fog/aws/models/compute/image.rb
fog-0.3.13 lib/fog/aws/models/compute/image.rb
fog-0.3.12 lib/fog/aws/models/compute/image.rb
fog-0.3.11 lib/fog/aws/models/compute/image.rb
fog-0.3.10 lib/fog/aws/models/compute/image.rb
fog-0.3.9 lib/fog/aws/models/compute/image.rb
fog-0.3.8 lib/fog/aws/models/compute/image.rb