Sha256: ee29f18e3571d66a7ada4c13858584d5be0f2f0695ea7274e53e9453ab479d6f

Contents?: true

Size: 1.63 KB

Versions: 41

Compression:

Stored size: 1.63 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

        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

        def ready?
          state == 'available'
        end

      end

    end
  end
end

Version data entries

41 entries across 41 versions & 13 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/compute/image.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/compute/image.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/compute/image.rb
fog-test-again-1.6.0 lib/fog/aws/models/compute/image.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/compute/image.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/compute/image.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/compute/image.rb
fog-1.8.0 lib/fog/aws/models/compute/image.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/compute/image.rb
fog-1.7.0 lib/fog/aws/models/compute/image.rb
fog-1.6.0 lib/fog/aws/models/compute/image.rb
fog-1.5.0 lib/fog/aws/models/compute/image.rb
fog-1.4.0 lib/fog/aws/models/compute/image.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/image.rb
michiels-fog-1.3.1 lib/fog/aws/models/compute/image.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/compute/image.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/image.rb
fog-1.3.1 lib/fog/aws/models/compute/image.rb
fog-1.3.0 lib/fog/aws/models/compute/image.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/image.rb