2011-08-11 12:53:52 -04:00
|
|
|
require 'fog/compute/models/server'
|
2011-04-27 21:49:56 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class StormOnDemand
|
2011-04-27 21:49:56 -04:00
|
|
|
|
2011-08-11 12:53:52 -04:00
|
|
|
class Server < Fog::Compute::Server
|
2011-04-27 21:49:56 -04:00
|
|
|
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
|
2011-08-11 12:53:52 -04:00
|
|
|
|
2012-10-03 06:49:55 -04:00
|
|
|
attr_writer :password
|
2011-04-27 21:49:56 -04:00
|
|
|
|
|
|
|
def initialize(attributes={})
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def create(options)
|
2012-12-22 18:23:26 -05:00
|
|
|
data = service.create_server(options).body['servers']
|
2011-04-27 21:49:56 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
2011-05-10 19:52:43 -04:00
|
|
|
def destroy
|
2011-04-27 21:49:56 -04:00
|
|
|
requires :identity
|
2012-12-22 18:23:26 -05:00
|
|
|
service.delete_server(:uniq_id => identity)
|
2011-04-27 21:49:56 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def ready?
|
|
|
|
active == 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def reboot
|
|
|
|
requires :identity
|
2012-12-22 18:23:26 -05:00
|
|
|
service.reboot_server(:uniq_id => identity)
|
2011-04-27 21:49:56 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def clone(options)
|
|
|
|
requires :identity
|
2012-12-22 18:23:26 -05:00
|
|
|
service.clone_server({:uniq_id => identity}.merge!(options))
|
2011-04-27 21:49:56 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
def resize(options)
|
|
|
|
requires :identity
|
2012-12-22 18:23:26 -05:00
|
|
|
service.resize_server({:uniq_id => identity}.merge!(options))
|
2011-04-27 21:49:56 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|