Sha256: dde52bc1f05d6859e618dec49f0b39bee0e302e2d27380d399e1aa4c35bb1f9c

Contents?: true

Size: 1.8 KB

Versions: 15

Compression:

Stored size: 1.8 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'
        attribute :creation_date,         :aliases => 'creationDate'
        attribute :ena_support,           :aliases => 'enaSupport'

        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

15 entries across 13 versions & 2 rubygems

Version Path
fog-aws-3.1.0 lib/fog/aws/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/models/compute/image.rb
fog-aws-3.0.0 lib/fog/aws/models/compute/image.rb
fog-aws-2.0.1 lib/fog/aws/models/compute/image.rb
fog-aws-2.0.0 lib/fog/aws/models/compute/image.rb
fog-aws-1.4.1 lib/fog/aws/models/compute/image.rb
fog-aws-1.4.0 lib/fog/aws/models/compute/image.rb
fog-aws-1.3.0 lib/fog/aws/models/compute/image.rb
fog-aws-1.2.1 lib/fog/aws/models/compute/image.rb
fog-aws-1.2.0 lib/fog/aws/models/compute/image.rb
fog-aws-1.1.0 lib/fog/aws/models/compute/image.rb
fog-aws-1.0.0 lib/fog/aws/models/compute/image.rb
fog-aws-0.13.0 lib/fog/aws/models/compute/image.rb