Sha256: 2b26c2ad7cfe8289509c9b9bfd803ad0bf217ad166aa6c02a56685fe71d82f0a

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module Rackspace
    class Servers

      class Server < Fog::Model

        identity :id

        attribute :addresses
        attribute :password,    'adminPass'
        attribute :flavor_id,   'flavorId'
        attribute :host_id,     'hostId'
        attribute :image_id,    'imageId'
        attribute :metadata
        attribute :name
        attribute :personality
        attribute :progress
        attribute :status

        def destroy
          requires :id
          connection.delete_server(@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 images
          requires :id
          connection.images(:server => self)
        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
          options = { 'metadata' => @metadata, 'personality' => @personality }
          options = options.reject {|key, value| value.nil?}
          data = connection.create_server(@flavor_id, @image_id, @name, options)
          merge_attributes(data.body['server'])
          true
        end

      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
fog-0.0.58 lib/fog/rackspace/models/servers/server.rb
fog-0.0.57 lib/fog/rackspace/models/servers/server.rb
fog-0.0.56 lib/fog/rackspace/models/servers/server.rb
fog-0.0.55 lib/fog/rackspace/models/servers/server.rb
fog-0.0.54 lib/fog/rackspace/models/servers/server.rb
fog-0.0.53 lib/fog/rackspace/models/servers/server.rb
fog-0.0.52 lib/fog/rackspace/models/servers/server.rb
fog-0.0.51 lib/fog/rackspace/models/servers/server.rb
fog-0.0.50 lib/fog/rackspace/models/servers/server.rb
fog-0.0.49 lib/fog/rackspace/models/servers/server.rb
fog-0.0.48 lib/fog/rackspace/models/servers/server.rb
fog-0.0.47 lib/fog/rackspace/models/servers/server.rb
fog-0.0.46 lib/fog/rackspace/models/servers/server.rb
fog-0.0.45 lib/fog/rackspace/models/servers/server.rb
fog-0.0.44 lib/fog/rackspace/models/servers/server.rb
fog-0.0.43 lib/fog/rackspace/models/servers/server.rb
fog-0.0.42 lib/fog/rackspace/models/servers/server.rb
fog-0.0.41 lib/fog/rackspace/models/servers/server.rb
fog-0.0.40 lib/fog/rackspace/models/servers/server.rb