Sha256: f88883aa184065ee957dac36920587ae9b59ba969c8cbe88bee528346bdaeee9

Contents?: true

Size: 1.18 KB

Versions: 24

Compression:

Stored size: 1.18 KB

Contents

require 'fog/core/model'

module Fog
  module Brightbox
    class Compute

      class Image < Fog::Model

        identity :id

        attribute :url
        attribute :name
        attribute :status
        attribute :source
        attribute :source_type

        attribute :ancestor_id, :aliases => "ancestor", :squash => "id"
        attribute :owner_id, :aliases => "owner", :squash => "id"
        attribute :arch

        attribute :resource_type
        attribute :description
        attribute :public
        attribute :official
        attribute :virtual_size
        attribute :disk_size
        attribute :created_at

        def ready?
          status == "available"
        end

        def save
          requires :source, :arch
          options = {
            :source => source,
            :arch => arch,
            :name => name,
            :description => description
          }.delete_if {|k,v| v.nil? || v == "" }
          data = connection.create_image(options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          connection.destroy_image(identity)
          true
        end

      end

    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
fog-0.8.2 lib/fog/compute/models/brightbox/image.rb
fog-0.8.1 lib/fog/compute/models/brightbox/image.rb
fog-0.8.0 lib/fog/compute/models/brightbox/image.rb
fog-0.7.2 lib/fog/compute/models/brightbox/image.rb
fog-0.7.1 lib/fog/compute/models/brightbox/image.rb
fog-0.7.0 lib/fog/compute/models/brightbox/image.rb
bbcloud-0.11.2 lib/bbcloud/vendor/fog/lib/fog/compute/models/brightbox/image.rb
bbcloud-0.11.1 lib/bbcloud/vendor/fog/lib/fog/compute/models/brightbox/image.rb
bbcloud-0.11.0 lib/bbcloud/vendor/fog/lib/fog/compute/models/brightbox/image.rb
fog-0.6.0 lib/fog/compute/models/brightbox/image.rb
fog-0.5.3 lib/fog/compute/models/brightbox/image.rb
fog-0.5.2 lib/fog/compute/models/brightbox/image.rb
fog-0.5.1 lib/fog/compute/models/brightbox/image.rb
fog-0.5.0 lib/fog/compute/models/brightbox/image.rb
phpfog-fog-0.4.1.3 lib/fog/compute/models/brightbox/image.rb
phpfog-fog-0.4.1.2 lib/fog/compute/models/brightbox/image.rb
phpfog-fog-0.4.1.1 lib/fog/compute/models/brightbox/image.rb
phpfog-fog-0.4.1 lib/fog/compute/models/brightbox/image.rb
fog-0.4.1 lib/fog/compute/models/brightbox/image.rb
fog-0.4.0 lib/fog/brightbox/models/compute/image.rb