Class: Roca::VirtualMachine
- Inherits:
-
Object
- Object
- Roca::VirtualMachine
- Extended by:
- ConnectorHelper::ClassMethods
- Includes:
- ConnectorHelper
- Defined in:
- lib/roca/virtual_machine.rb
Instance Attribute Summary collapse
-
#cpu ⇒ Object
readonly
Returns the value of attribute cpu.
-
#group_id ⇒ Object
readonly
Returns the value of attribute group_id.
-
#group_name ⇒ Object
readonly
Returns the value of attribute group_name.
-
#last_poll ⇒ Object
readonly
Returns the value of attribute last_poll.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#net_rx ⇒ Object
readonly
Returns the value of attribute net_rx.
-
#net_tx ⇒ Object
readonly
Returns the value of attribute net_tx.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
-
#virtual_machine_id ⇒ Object
readonly
Returns the value of attribute virtual_machine_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ VirtualMachine
constructor
A new instance of VirtualMachine.
Methods included from ConnectorHelper::ClassMethods
Methods included from ConnectorHelper
Constructor Details
#initialize(attributes = {}) ⇒ VirtualMachine
Returns a new instance of VirtualMachine.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/roca/virtual_machine.rb', line 34 def initialize(attributes = {}) @virtual_machine_id = attributes[:virtual_machine_id], @user_id = attributes[:user_id], @group_id = attributes[:group_id], @user_name = attributes[:user_name], @group_name = attributes[:group_name], @name = attributes[:name], @last_poll = attributes[:last_poll], @state = attributes[:state], @lcm_state = attributes[:lcm_state], @stime = attributes[:stime], @etime = attributes[:etime], @memory = attributes[:memory], @cpu = attributes[:cpu], @net_tx = attributes[:net_tx], @net_rx = attributes[:net_rx] end |
Instance Attribute Details
#cpu ⇒ Object (readonly)
Returns the value of attribute cpu.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def cpu @cpu end |
#group_id ⇒ Object (readonly)
Returns the value of attribute group_id.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def group_id @group_id end |
#group_name ⇒ Object (readonly)
Returns the value of attribute group_name.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def group_name @group_name end |
#last_poll ⇒ Object (readonly)
Returns the value of attribute last_poll.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def last_poll @last_poll end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def memory @memory end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def name @name end |
#net_rx ⇒ Object (readonly)
Returns the value of attribute net_rx.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def net_rx @net_rx end |
#net_tx ⇒ Object (readonly)
Returns the value of attribute net_tx.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def net_tx @net_tx end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def state @state end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def user_id @user_id end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def user_name @user_name end |
#virtual_machine_id ⇒ Object (readonly)
Returns the value of attribute virtual_machine_id.
6 7 8 |
# File 'lib/roca/virtual_machine.rb', line 6 def virtual_machine_id @virtual_machine_id end |
Class Method Details
.build_from_hash(attributes = {}) ⇒ Object
8 9 10 |
# File 'lib/roca/virtual_machine.rb', line 8 def self.build_from_hash(attributes = {}) VirtualMachine.new(attributes) end |
.build_from_xml(xml_description) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/roca/virtual_machine.rb', line 12 def self.build_from_xml(xml_description) doc = Nokogiri::Slop(xml_description) VirtualMachine.build_from_hash( virtual_machine_id: doc.VM.ID.content.to_i, user_id: doc.VM.UID.content.to_i, group_id: doc.VM.GID.content.to_i, user_name: doc.VM.UNAME.content, group_name: doc.VM.GNAME.content, name: doc.VM.NAME.content, last_poll: doc.VM.LAST_POLL.content.to_i, state: doc.VM.STATE.content.to_i, lcm_state: doc.VM.LCM_STATE.content.to_i, stime: doc.VM.STIME.content.to_i, etime: doc.VM.ETIME.content.to_i, memory: doc.VM.MEMORY.content.to_i, cpu: doc.VM.CPU.content.to_i, net_tx: doc.VM.NET_TX.content.to_i, net_rx: doc.VM.NET_RX.content.to_i ) end |