Sha256: cd375e2d64963435d7fb11322d4ec031f57ab95c8b577f6545c9e37f9b6ddd47

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

require 'fog/openstack/models/model'
require 'fog/openstack/models/compute/metadata'

module Fog
  module Compute
    class OpenStack
      class Image < Fog::OpenStack::Model
        identity :id

        attribute :name
        attribute :created_at,  :aliases => 'created'
        attribute :updated_at,  :aliases => 'updated'
        attribute :progress
        attribute :status
        attribute :minDisk
        attribute :minRam
        attribute :server,   :aliases => 'server'
        attribute :metadata
        attribute :links

        def metadata
          @metadata ||= begin
            Fog::Compute::OpenStack::Metadata.new({
              :service => service,
              :parent => self
            })
          end
        end

        def metadata=(new_metadata={})
          metas = []
          new_metadata.each_pair {|k,v| metas << {"key" => k, "value" => v} }
          metadata.load(metas)
        end

        def destroy
          requires :id
          service.delete_image(id)
          true
        end

        def ready?
          status == 'ACTIVE'
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.9 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.8 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.7 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.6 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.5 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.4 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.3 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.2 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.1 lib/fog/openstack/models/compute/image.rb
fog-openstack-0.1.0 lib/fog/openstack/models/compute/image.rb
fog-1.37.0 lib/fog/openstack/models/compute/image.rb
fog-1.36.0 lib/fog/openstack/models/compute/image.rb
fog-1.35.0 lib/fog/openstack/models/compute/image.rb
fog-2.0.0.pre.0 lib/fog/openstack/models/compute/image.rb
fog-1.34.0 lib/fog/openstack/models/compute/image.rb
fog-1.33.0 lib/fog/openstack/models/compute/image.rb