Class: UnitHosting::Vm

Inherits:
Base
  • Object
show all
Defined in:
lib/unit_hosting/vm.rb

Instance Attribute Summary

Attributes inherited from Base

#instance_id

Instance Method Summary collapse

Methods inherited from Base

load, #load, #load_key, #server_call

Constructor Details

#initialize(instance_id = nil, api_key = nil) ⇒ Vm

Returns a new instance of Vm.



7
8
9
10
11
# File 'lib/unit_hosting/vm.rb', line 7

def initialize(instance_id=nil,api_key=nil)
  @instance_id_elm = '/server/instance_id'
  @api_key_elm = '/server/key'
  super
end

Instance Method Details

#cpu_unit_num(num) ⇒ Object



33
34
35
# File 'lib/unit_hosting/vm.rb', line 33

def cpu_unit_num num
  server_call("vm.setCpuUnitNum",{"num" => num})
end

#cpu_unit_num?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/unit_hosting/vm.rb', line 39

def cpu_unit_num?
  server_call("vm.getCpuUnitNum")
end

#destroyObject



24
25
26
# File 'lib/unit_hosting/vm.rb', line 24

def destroy
  server_call("vm.destroy")
end

#display_nameObject



45
46
47
# File 'lib/unit_hosting/vm.rb', line 45

def display_name
  server_call("vm.getDisplayName")
end

#display_name=(name) ⇒ Object



48
49
50
# File 'lib/unit_hosting/vm.rb', line 48

def display_name= name
  server_call("vm.setDisplayName",{"display_name" => name})
end

#ipInfo?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/unit_hosting/vm.rb', line 42

def ipInfo?
  server_call("vm.getIpInfo")
end

#memory_unit_size(size) ⇒ Object



30
31
32
# File 'lib/unit_hosting/vm.rb', line 30

def memory_unit_size size
  server_call("vm.setMemoryUnitSize",{"size" => size})
end

#memory_unit_size?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/unit_hosting/vm.rb', line 36

def memory_unit_size?
  server_call("vm.getMemoryUnitSize")
end

#power_offObject



21
22
23
# File 'lib/unit_hosting/vm.rb', line 21

def power_off
  server_call("vm.powerOff")
end

#rebootObject



12
13
14
# File 'lib/unit_hosting/vm.rb', line 12

def reboot
  server_call("vm.reboot")
end

#replicate(name = "") ⇒ Object



51
52
53
# File 'lib/unit_hosting/vm.rb', line 51

def replicate name=""
  server_call("vm.replicate",{"display_name" => name})
end

#shutdownObject



18
19
20
# File 'lib/unit_hosting/vm.rb', line 18

def shutdown
  server_call("vm.shutdown")
end

#startObject



15
16
17
# File 'lib/unit_hosting/vm.rb', line 15

def start
  server_call("vm.start")
end

#status?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/unit_hosting/vm.rb', line 27

def status?
  server_call("vm.getStatus")
end