Class: Fog::Compute::VirtualBox::NetworkAdapters

Inherits:
Fog::Collection show all
Defined in:
lib/fog/compute/models/virtual_box/network_adapters.rb

Instance Attribute Summary collapse

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Attribute Details

#machineObject

Returns the value of attribute machine.



12
13
14
# File 'lib/fog/compute/models/virtual_box/network_adapters.rb', line 12

def machine
  @machine
end

Instance Method Details

#allObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/compute/models/virtual_box/network_adapters.rb', line 14

def all
  requires :machine
  data = []
  raw_machine = machine.instance_variable_get(:@raw)
  connection.system_properties.network_adapter_count.times do |index|
    data << {
      :raw  => raw_machine.get_network_adapter(index)
    }
  end
  load(data)
end

#get(network_adapter_slot) ⇒ Object



26
27
28
29
30
31
# File 'lib/fog/compute/models/virtual_box/network_adapters.rb', line 26

def get(network_adapter_slot)
  requires :machine
  raw_machine = machine.instance_variable_get(:@raw)
  network_adapter = raw_machine.get_network_adapter(network_adapter_slot)
  new(:raw => network_adapter)
end

#new(attributes = {}) ⇒ Object



33
34
35
36
# File 'lib/fog/compute/models/virtual_box/network_adapters.rb', line 33

def new(attributes = {})
  requires :machine
  super({ :machine => machine }.merge!(attributes))
end