lib/yao/resources/server.rb in yao-0.1.1 vs lib/yao/resources/server.rb in yao-0.2.0.rc1
- old
+ new
@@ -1,6 +1,7 @@
require 'yao/resources/metadata_available'
+require 'yao/resources/action'
module Yao::Resources
class Server < Base
friendly_attributes :addresses, :metadata, :name, :progress,
:status, :tenant_id, :user_id, :key_name
map_attribute_to_attribute :hostId => :host_id
@@ -19,8 +20,21 @@
self.service = "compute"
self.resource_name = "server"
self.resources_name = "servers"
+ def self.shutoff(id)
+ action(id, "os-stop" => nil)
+ end
+
+ def self.reboot(id)
+ action(id,"reboot" => { "type" => "HARD" })
+ end
+
+ def self.resize(id, flavor_id)
+ action(id,"resize" => { "flavorRef" => flavor_id })
+ end
+
extend MetadataAvailable
+ extend Action
end
end