Sha256: 3ef0fe04b131f7613718b519ecdcbf8f93d0100d30a45a4daf70da89300db530

Contents?: true

Size: 1.12 KB

Versions: 69

Compression:

Stored size: 1.12 KB

Contents

require 'fog/model'

module Fog
  module Slicehost

    class Server < Fog::Model

      identity :id

      attribute :addresses
      attribute :backup_id,     'backup-id'
      attribute :bandwidth_in,  'bw-in'
      attribute :bandwidth_out, 'bw-out'
      attribute :flavor_id,     'flavor-id'
      attribute :image_id,      'image-id'
      attribute :name
      attribute :password,      'root-password'
      attribute :progress
      attribute :status

      def destroy
        requires :id
        connection.delete_slice(@id)
        true
      end

      def flavor
        requires :flavor_id
        connection.flavors.get(@flavor_id)
      end

      def image
        requires :image_id
        connection.images.get(@image_id)
      end

      def ready?
        @status == 'active'
      end

      def reboot(type = 'SOFT')
        requires :id
        connection.reboot_server(@id, type)
        true
      end

      def save
        requires :flavor_id, :image_id, :name
        data = connection.create_slice(@flavor_id, @image_id, @name)
        merge_attributes(data.body)
        true
      end

    end

  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
fog-0.2.15 lib/fog/slicehost/models/server.rb
fog-0.2.14 lib/fog/slicehost/models/server.rb
fog-0.2.13 lib/fog/slicehost/models/server.rb
fog-0.2.12 lib/fog/slicehost/models/server.rb
fog-0.2.11 lib/fog/slicehost/models/server.rb
fog-0.2.10 lib/fog/slicehost/models/server.rb
fog-0.2.9 lib/fog/slicehost/models/server.rb
fog-0.2.8 lib/fog/slicehost/models/server.rb
fog-0.2.7 lib/fog/slicehost/models/server.rb
fog-0.2.6 lib/fog/slicehost/models/server.rb
fog-0.2.5 lib/fog/slicehost/models/server.rb
fog-0.2.4 lib/fog/slicehost/models/server.rb
fog-0.2.3 lib/fog/slicehost/models/server.rb
fog-0.2.2 lib/fog/slicehost/models/server.rb
fog-0.2.1 lib/fog/slicehost/models/server.rb
fog-0.2.0 lib/fog/slicehost/models/server.rb
fog-0.1.10 lib/fog/slicehost/models/server.rb
fog-0.1.9 lib/fog/slicehost/models/server.rb
fog-0.1.8 lib/fog/slicehost/models/server.rb
fog-0.1.7 lib/fog/slicehost/models/server.rb