Class: VirtualMachine
- Inherits:
-
Object
- Object
- VirtualMachine
- Defined in:
- lib/smartos-manager/core.rb
Instance Attribute Summary collapse
-
#admin_ip ⇒ Object
readonly
Returns the value of attribute admin_ip.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rss ⇒ Object
readonly
Returns the value of attribute rss.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(data = {}, rss = {}) ⇒ VirtualMachine
constructor
A new instance of VirtualMachine.
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_ip ⇒ Object (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 |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
49 50 51 |
# File 'lib/smartos-manager/core.rb', line 49 def memory @memory end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/smartos-manager/core.rb', line 49 def name @name end |
#rss ⇒ Object (readonly)
Returns the value of attribute rss.
49 50 51 |
# File 'lib/smartos-manager/core.rb', line 49 def rss @rss end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
49 50 51 |
# File 'lib/smartos-manager/core.rb', line 49 def state @state end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
49 50 51 |
# File 'lib/smartos-manager/core.rb', line 49 def type @type end |
#uuid ⇒ Object (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 |