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/slicehost/models/server.rb
2010-02-04 00:27:14 -08:00

55 lines
1.1 KiB
Ruby

module Fog
class Slicehost
class Server < Fog::Model
identity :id
attribute :addresses
attribute :backup_id, 'backup-id'
attribute :bw_in, 'bw-in'
attribute :bw_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