Sha256: 98b166f000fed7b711243efae182b2bbcf9086e35a8aaf807093b2bf91e5f6d9

Contents?: true

Size: 1.17 KB

Versions: 32

Compression:

Stored size: 1.17 KB

Contents

require 'fog/openstack/models/model'
require 'fog/compute/openstack/models/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 :size,     :aliases => 'OS-EXT-IMG-SIZE:size'
        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

32 entries across 30 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.10 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.1.30 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.1.29 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.9 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.1.28 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.8 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.7 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.6 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.5 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.4 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.3 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.2 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.3.0 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.2.4 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.2.3 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.2.2 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.2.1 lib/fog/compute/openstack/models/image.rb
fog-openstack-0.2.0 lib/fog/compute/openstack/models/image.rb
fog-zj-0.1.28 lib/fog/compute/openstack/models/image.rb