class UnitHosting::Api::Vm

Public Class Methods

new(instance_id=nil,api_key=nil) click to toggle source
Calls superclass method UnitHosting::Api::Base::new
# File lib/unit-hosting/api/vm.rb, line 9
def initialize(instance_id=nil,api_key=nil)
  @instance_id_elm = '/server/instance_id'
  @api_key_elm = '/server/key'
  super
end

Public Instance Methods

cpu_unit_num(num) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 36
def cpu_unit_num num
  server_call("vm.setCpuUnitNum",{"num" => num})
end
display_name() click to toggle source
# File lib/unit-hosting/api/vm.rb, line 42
def display_name
  server_call("vm.getDisplayName")
end
display_name=(name) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 45
def display_name= name
  server_call("vm.setDisplayName",{"display_name" => name})
end
get_pv_args() click to toggle source
# File lib/unit-hosting/api/vm.rb, line 69
def get_pv_args
  server_call("vm.getPvArgs")
end
get_vm_data(key) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 63
def get_vm_data(key)
  server_call("vm.getVmData",{"key" =>key})
end
ips() click to toggle source
# File lib/unit-hosting/api/vm.rb, line 39
def ips
  server_call("vm.getIpInfo")
end
memory_unit_size(size) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 33
def memory_unit_size size
  server_call("vm.setMemoryUnitSize",{"size" => size})
end
method_missing(name, *args) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 19
def method_missing(name, *args)
  name = name.to_s
  name = if /(.*)\?$/ =~ name
           "get#{$1.camelize}"
         else
           name.camelize(:lower)
         end
  if args.blank?
    server_call(to_api(name))
  else
    server_call(to_api(name),*args)
  end
end
plugVif(network,device = nil) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 51
def plugVif network,device = nil
  server_call("vm.plugVif",{"network_uuid" => network,"device" => device})
end
replicate(name="") click to toggle source
# File lib/unit-hosting/api/vm.rb, line 48
def replicate name=""
  server_call("vm.replicate",{"display_name" => name})
end
set_pv_args(val) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 66
def set_pv_args(val)
  server_call("vm.setPvArgs",{"pv_args" =>val})
end
set_vm_data(key,val) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 60
def set_vm_data(key,val)
  server_call("vm.setVmData",{"key" =>key,"value" =>val})
end
to_api(name) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 15
def to_api(name)
  "vm.#{name}"
end
unplugVif(vif_uuid) click to toggle source
# File lib/unit-hosting/api/vm.rb, line 57
def unplugVif vif_uuid
  server_call("vm.unplugVif",{"vif_uuid" => vif_uuid})
end
vifs() click to toggle source
# File lib/unit-hosting/api/vm.rb, line 54
def vifs
  server_call("vm.getVifs")
end