Class: SakuraCloud::Server
- Inherits:
-
Object
- Object
- SakuraCloud::Server
- Defined in:
- lib/sakura_cloud.rb
Instance Method Summary collapse
-
#initialize(api_key, api_secret, api_server, server_id) ⇒ Server
constructor
A new instance of Server.
-
#keyboard(*keys) ⇒ Object
ex keyboard().
- #plan=(plan_id) ⇒ Object
- #power ⇒ Object
- #profile ⇒ Object (also: #server)
- #reset ⇒ Object
- #status ⇒ Object
- #turn_off ⇒ Object
- #turn_on ⇒ Object
- #vnc_snapshot ⇒ Object
Constructor Details
#initialize(api_key, api_secret, api_server, server_id) ⇒ Server
Returns a new instance of Server.
20 21 22 23 24 25 |
# File 'lib/sakura_cloud.rb', line 20 def initialize(api_key,api_secret,api_server,server_id) @api_key=api_key @api_secret=api_secret @api_server=api_server @server_id=server_id end |
Instance Method Details
#keyboard(*keys) ⇒ Object
ex keyboard()
48 49 50 |
# File 'lib/sakura_cloud.rb', line 48 def keyboard(*keys) #ex keyboard(["ctrl","alt","delete"]) response=put(@api_server,"/server/#{@server_id}/keyboard","Keys"=>keys) end |
#plan=(plan_id) ⇒ Object
30 31 32 |
# File 'lib/sakura_cloud.rb', line 30 def plan=(plan_id) response=put(@api_server,"/server/#{@server_id}/to/plan/#{plan_id}") end |
#power ⇒ Object
36 37 38 |
# File 'lib/sakura_cloud.rb', line 36 def power response=get(@api_server,"/server/#{@server_id}/power") end |
#profile ⇒ Object Also known as: server
26 27 28 |
# File 'lib/sakura_cloud.rb', line 26 def profile response=get(@api_server,"/server/"+@server_id) end |
#reset ⇒ Object
45 46 47 |
# File 'lib/sakura_cloud.rb', line 45 def reset response=put(@api_server,"/server/#{@server_id}/reset") end |
#status ⇒ Object
33 34 35 |
# File 'lib/sakura_cloud.rb', line 33 def status response=get(@api_server,"/server/#{@server_id}/monitor") end |
#turn_off ⇒ Object
42 43 44 |
# File 'lib/sakura_cloud.rb', line 42 def turn_off response=delete(@api_server,"/server/#{@server_id}/power") end |
#turn_on ⇒ Object
39 40 41 |
# File 'lib/sakura_cloud.rb', line 39 def turn_on response=put(@api_server,"/server/#{@server_id}/power") end |
#vnc_snapshot ⇒ Object
51 52 53 |
# File 'lib/sakura_cloud.rb', line 51 def vnc_snapshot response=get(@api_server,"/server/#{@server_id}/vnc/snapshot.png") end |