1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/models/servers/server.rb

52 lines
1.1 KiB
Ruby
Raw Normal View History

module Fog
module Rackspace
class Server
class Server < Fog::Model
attribute :admin_pass, 'adminPass'
attribute :id
attribute :name
attribute :image_id, 'imageId'
attribute :flavor_id, 'flavorId'
attribute :host_id, 'hostId'
attribute :status
attribute :personality
attribute :progress
attribute :addresses
attribute :metadata
def destroy
connection.delete_server(@id)
true
end
def reload
new_attributes = servers.get(@id).attributes
merge_attributes(new_attributes)
end
def save
2009-10-15 18:06:50 -04:00
options = { :metadata => @metadata, :name => @name, :personality => @personality }
options = options.reject {|key, value| value.nil?}
data = connection.create_server(@flavor_id, @image_id, options)
merge_attributes(data.body['server'])
true
end
def servers
@servers
end
private
def servers=(new_servers)
@servers = new_servers
end
end
end
end
end