Sha256: 80486ccf26b8669b52150f1ec3fc46fd31faf5fc8f5d313f825c418a220ac8a4

Contents?: true

Size: 1.37 KB

Versions: 43

Compression:

Stored size: 1.37 KB

Contents

require 'fog/core/model'

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

        attribute :name
        attribute :description
        attribute :friendly_name, :aliases => 'friendlyName'
        attribute :created_at,    :aliases => 'createdTime'
        attribute :updated_at,    :aliases => 'updatedTime'
        attribute :server_id,     :aliases => 'id'
        attribute :state
        attribute :price
        attribute :location
        attribute :billingtokens
        attribute :os
        attribute :architecture
        attribute :type
        attribute :active,        :aliases => 'isActive'
        attribute :public,        :aliases => 'isPublic'
        attribute :object_type,   :aliases => 'object'
        attribute :owner

        def server=(new_server)
          requires :id

          @server_id = new_server.id
        end

        def destroy
          requires :id

          service.grid_server_delete(id)
          true
        end

        def ready?
          status == 'Available'
        end

        def save
          raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
          requires :server_id

          data = service.grid_server_add(server_id, 'name' => name)
          merge_attributes(data.body['image'])
          true
        end
      end
    end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 lib/fog/go_grid/models/compute/image.rb
fog-ifeel-2.2.0 lib/fog/go_grid/models/compute/image.rb
fog-2.2.0 lib/fog/go_grid/models/compute/image.rb
fog-2.1.0 lib/fog/go_grid/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/go_grid/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/go_grid/models/compute/image.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/go_grid/models/compute/image.rb
fog-1.42.1 lib/fog/go_grid/models/compute/image.rb
fog-2.0.0 lib/fog/go_grid/models/compute/image.rb
fog-1.42.0 lib/fog/go_grid/models/compute/image.rb
fog-1.41.0 lib/fog/go_grid/models/compute/image.rb
fog-1.40.0 lib/fog/go_grid/models/compute/image.rb
fog-1.39.0 lib/fog/go_grid/models/compute/image.rb
fog-1.38.0 lib/fog/go_grid/models/compute/image.rb
fog-1.37.0 lib/fog/go_grid/models/compute/image.rb
fog-1.36.0 lib/fog/go_grid/models/compute/image.rb
fog-1.35.0 lib/fog/go_grid/models/compute/image.rb
fog-2.0.0.pre.0 lib/fog/go_grid/models/compute/image.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/go_grid/models/compute/image.rb
fog-1.34.0 lib/fog/go_grid/models/compute/image.rb