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

37 lines
882 B
Ruby

module Fog
module Rackspace
class Servers
class Server < Fog::Model
identity :id
attribute :admin_pass, 'adminPass'
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 save
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
end
end
end
end