Class: UnitHosting::Api::Vm

Inherits:
Base
  • Object
show all
Defined in:
lib/unit-hosting/api/vm.rb

Instance Attribute Summary

Attributes inherited from Base

#api_key, #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.



8
9
10
11
12
# File 'lib/unit-hosting/api/vm.rb', line 8

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



34
35
36
# File 'lib/unit-hosting/api/vm.rb', line 34

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

#cpu_unit_num?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/unit-hosting/api/vm.rb', line 40

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

#destroyObject



25
26
27
# File 'lib/unit-hosting/api/vm.rb', line 25

def destroy
  server_call("vm.destroy")
end

#display_nameObject



46
47
48
# File 'lib/unit-hosting/api/vm.rb', line 46

def display_name
  server_call("vm.getDisplayName")
end

#display_name=(name) ⇒ Object



49
50
51
# File 'lib/unit-hosting/api/vm.rb', line 49

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

#get_vm_data(key) ⇒ Object



67
68
69
# File 'lib/unit-hosting/api/vm.rb', line 67

def get_vm_data(key)
  server_call("vm.getVmData",{"key" =>key})
end

#ipsObject



43
44
45
# File 'lib/unit-hosting/api/vm.rb', line 43

def ips
  server_call("vm.getIpInfo")
end

#memory_unit_size(size) ⇒ Object



31
32
33
# File 'lib/unit-hosting/api/vm.rb', line 31

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

#memory_unit_size?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/unit-hosting/api/vm.rb', line 37

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

#plugVif(network, device = nil) ⇒ Object



55
56
57
# File 'lib/unit-hosting/api/vm.rb', line 55

def plugVif network,device = nil
  server_call("vm.plugVif",{"network_uuid" => network,"device" => device})
end

#power_offObject



22
23
24
# File 'lib/unit-hosting/api/vm.rb', line 22

def power_off
  server_call("vm.powerOff")
end

#rebootObject



13
14
15
# File 'lib/unit-hosting/api/vm.rb', line 13

def reboot
  server_call("vm.reboot")
end

#replicate(name = "") ⇒ Object



52
53
54
# File 'lib/unit-hosting/api/vm.rb', line 52

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

#set_vm_data(key, val) ⇒ Object



64
65
66
# File 'lib/unit-hosting/api/vm.rb', line 64

def set_vm_data(key,val)
  server_call("vm.setVmData",{"key" =>key,"value" =>val})
end

#shutdownObject



19
20
21
# File 'lib/unit-hosting/api/vm.rb', line 19

def shutdown
  server_call("vm.shutdown")
end

#startObject



16
17
18
# File 'lib/unit-hosting/api/vm.rb', line 16

def start
  server_call("vm.start")
end

#status?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/unit-hosting/api/vm.rb', line 28

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

#unplugVif(vif_uuid) ⇒ Object



61
62
63
# File 'lib/unit-hosting/api/vm.rb', line 61

def unplugVif vif_uuid
  server_call("vm.unplugVif",{"vif_uuid" => vif_uuid})
end

#vifsObject



58
59
60
# File 'lib/unit-hosting/api/vm.rb', line 58

def vifs
  server_call("vm.getVifs")
end