Sha256: 2c06c35b8d2470b186434114d28f5b6140fc3c96c82852ec8d8cb4991afc1a9e

Contents?: true

Size: 1.69 KB

Versions: 20

Compression:

Stored size: 1.69 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class AWS
      class Image < Fog::Model
        identity :id,                     :aliases => 'imageId'

        attribute :architecture
        attribute :block_device_mapping,  :aliases => 'blockDeviceMapping'
        attribute :description
        attribute :location,              :aliases => 'imageLocation'
        attribute :owner_id,              :aliases => 'imageOwnerId'
        attribute :owner_alias,           :aliases => 'imageOwnerAlias'
        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'
        attribute :name
        attribute :virtualization_type,   :aliases => 'virtualizationType'

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

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

        def ready?
          state == 'available'
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
fog-aws-0.1.1 lib/fog/aws/models/compute/image.rb
fog-aws-0.1.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.0.8 lib/fog/aws/models/compute/image.rb
fog-aws-0.0.7 lib/fog/aws/models/compute/image.rb
fog-aws-0.0.6 lib/fog/aws/models/compute/image.rb
fog-aws-0.0.5 lib/fog/aws/models/compute/image.rb
fog-1.26.0 lib/fog/aws/models/compute/image.rb
fog-1.25.0 lib/fog/aws/models/compute/image.rb
nsidc-fog-1.24.1 lib/fog/aws/models/compute/image.rb
fog-1.24.0 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.11 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.10 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.9 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.8 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.7 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.6 lib/fog/aws/models/compute/image.rb
fog-1.23.0 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.4 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.3 lib/fog/aws/models/compute/image.rb
ns-fog-1.22.2 lib/fog/aws/models/compute/image.rb