Class: VirtualMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/smartos-manager/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}, rss = {}) ⇒ VirtualMachine

Returns a new instance of VirtualMachine.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/smartos-manager/core.rb', line 51

def initialize(data = {}, rss = {})
  @uuid = data.delete('uuid')
  @type = data.delete('type')
  @memory = data.delete('ram').to_i.megabytes
  @state = data.delete('state')
  @name = data.delete('alias')
  @admin_ip = data.delete('nics.0.ip')
  @rss = rss[@uuid]
  
  @user_data = data
end

Instance Attribute Details

#admin_ipObject (readonly)

Returns the value of attribute admin_ip.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def admin_ip
  @admin_ip
end

#memoryObject (readonly)

Returns the value of attribute memory.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def memory
  @memory
end

#nameObject (readonly)

Returns the value of attribute name.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def name
  @name
end

#rssObject (readonly)

Returns the value of attribute rss.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def rss
  @rss
end

#stateObject (readonly)

Returns the value of attribute state.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def state
  @state
end

#typeObject (readonly)

Returns the value of attribute type.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def type
  @type
end

#uuidObject (readonly)

Returns the value of attribute uuid.



49
50
51
# File 'lib/smartos-manager/core.rb', line 49

def uuid
  @uuid
end

Instance Method Details

#[](key) ⇒ Object



63
64
65
# File 'lib/smartos-manager/core.rb', line 63

def [](key)
  @user_data[key]
end