Sha256: af1aac32475a3279d93a9b11ab4771cdbef085a9756ee6f9af4088ffe4568c89

Contents?: true

Size: 1.67 KB

Versions: 24

Compression:

Stored size: 1.67 KB

Contents

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

24 entries across 24 versions & 2 rubygems

Version Path
fog-aws-0.12.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.11.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.10.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.9.4 lib/fog/aws/models/compute/image.rb
fog-aws-0.9.3 lib/fog/aws/models/compute/image.rb
fog-aws-0.9.2 lib/fog/aws/models/compute/image.rb
fog-aws-0.9.1 lib/fog/aws/models/compute/image.rb
fog-aws-0.9.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.8.1 lib/fog/aws/models/compute/image.rb
fog-aws-0.8.0 lib/fog/aws/models/compute/image.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/lib/fog/aws/models/compute/image.rb
fog-aws-0.7.6 lib/fog/aws/models/compute/image.rb
fog-aws-0.7.5 lib/fog/aws/models/compute/image.rb
fog-aws-0.7.4 lib/fog/aws/models/compute/image.rb
fog-aws-0.7.3 lib/fog/aws/models/compute/image.rb
fog-aws-0.7.2 lib/fog/aws/models/compute/image.rb
fog-aws-0.6.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.5.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.4.1 lib/fog/aws/models/compute/image.rb
fog-aws-0.4.0 lib/fog/aws/models/compute/image.rb