2011-04-27 21:49:56 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class StormOnDemand
|
2011-04-27 21:49:56 -04:00
|
|
|
|
|
|
|
class Server < Fog::Model
|
|
|
|
identity :uniq_id
|
|
|
|
|
|
|
|
attribute :accnt
|
|
|
|
attribute :backup_enabled
|
|
|
|
attribute :backup_plan
|
|
|
|
attribute :backup_quota
|
|
|
|
attribute :backup_size
|
|
|
|
attribute :bandwidth_quota
|
|
|
|
attribute :config_description
|
|
|
|
attribute :config_id
|
|
|
|
attribute :create_date
|
|
|
|
attribute :domain
|
|
|
|
attribute :ip
|
|
|
|
attribute :ip_count
|
|
|
|
attribute :manage_level
|
|
|
|
attribute :subaccnt
|
|
|
|
attribute :template
|
|
|
|
attribute :template_description
|
|
|
|
attribute :zone
|
|
|
|
attribute :active
|
|
|
|
|
|
|
|
attr_writer :password, :username
|
|
|
|
|
|
|
|
def initialize(attributes={})
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def create(options)
|
|
|
|
data = connection.create_server(options).body['servers']
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
2011-05-10 19:52:43 -04:00
|
|
|
def destroy
|
2011-04-27 21:49:56 -04:00
|
|
|
requires :identity
|
|
|
|
connection.delete_server(:uniq_id => identity)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def ready?
|
|
|
|
active == 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def reboot
|
|
|
|
requires :identity
|
|
|
|
connection.reboot_server(:uniq_id => identity)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def username
|
|
|
|
@username ||= 'root'
|
|
|
|
end
|
|
|
|
|
|
|
|
def clone(options)
|
|
|
|
requires :identity
|
|
|
|
connection.clone_server({:uniq_id => identity}.merge!(options))
|
|
|
|
true
|
|
|
|
end
|
|
|
|
def resize(options)
|
|
|
|
requires :identity
|
|
|
|
connection.resize_server({:uniq_id => identity}.merge!(options))
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|