Sha256: 75fb44122efa56d7bb6646ca76f708c2a6d0d1fd9d89f7bbd1ee64389f68d29f

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

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

9 entries across 9 versions & 2 rubygems

Version Path
fog-0.3.30 lib/fog/brightbox/models/compute/image.rb
fog-0.3.29 lib/fog/brightbox/models/compute/image.rb
fog-0.3.28 lib/fog/brightbox/models/compute/image.rb
fog-0.3.27 lib/fog/brightbox/models/compute/image.rb
fog-0.3.26 lib/fog/brightbox/models/compute/image.rb
fog-0.3.25 lib/fog/brightbox/models/compute/image.rb
fog-0.3.24 lib/fog/brightbox/models/compute/image.rb
bbcloud-0.8.1 lib/bbcloud/vendor/fog-0.3.23/lib/fog/brightbox/models/compute/image.rb
fog-0.3.23 lib/fog/brightbox/models/compute/image.rb