Class: VmInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/archipel/api/vm/vm_info.rb

Defined Under Namespace

Classes: State

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state, autostart, memory_kib, memory_max_kib, cpu_usage, cpu_number) ⇒ VmInfo

Returns a new instance of VmInfo.



45
46
47
48
49
50
51
52
53
54
# File 'lib/archipel/api/vm/vm_info.rb', line 45

def initialize state, autostart, memory_kib, memory_max_kib, cpu_usage, cpu_number
  @state = State.from_int state.to_i
  @autostart = autostart.to_i == 0 ? false : true

  @memory = memory_kib.to_i * 1024
  @memory_max = memory_max_kib.to_i * 1024

  @cpu_usage = cpu_usage.to_i
  @cpu_number = cpu_number.to_i
end

Instance Attribute Details

#autostartObject (readonly)

Returns the value of attribute autostart.



41
42
43
# File 'lib/archipel/api/vm/vm_info.rb', line 41

def autostart
  @autostart
end

#cpu_numberObject (readonly)

Returns the value of attribute cpu_number.



43
44
45
# File 'lib/archipel/api/vm/vm_info.rb', line 43

def cpu_number
  @cpu_number
end

#cpu_usageObject (readonly)

Returns the value of attribute cpu_usage.



43
44
45
# File 'lib/archipel/api/vm/vm_info.rb', line 43

def cpu_usage
  @cpu_usage
end

#memoryObject (readonly)

Returns the value of attribute memory.



42
43
44
# File 'lib/archipel/api/vm/vm_info.rb', line 42

def memory
  @memory
end

#memory_maxObject (readonly)

Returns the value of attribute memory_max.



42
43
44
# File 'lib/archipel/api/vm/vm_info.rb', line 42

def memory_max
  @memory_max
end

#stateObject (readonly)

Returns the value of attribute state.



40
41
42
# File 'lib/archipel/api/vm/vm_info.rb', line 40

def state
  @state
end