class Fog::Compute::VirtualBox::NetworkAdapter

Attributes

machine[RW]

Public Instance Methods

nat_driver() click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 42
def nat_driver
  Fog::Compute::VirtualBox::NATEngine.new(
    :connection       => connection,
    :machine          => machine,
    :network_adapter  => self,
    :raw              => raw.nat_driver
  )
end
save() click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 30
def save
  with_session do |session|
    session_raw = session.machine.get_network_adapter(slot)
    # for attribute in [:adapter_type, :bandwidth_limit, :boot_priority, :cable_connected, :enabled, :host_interface, :internal_network, :line_speed, :mac_address, :nat_network, :trace_enabled, :trace_file]
    #   session_raw.send("#{attribute}=", attributes[attribute])
    # end
    session_raw.mac_address = mac_address
    session.machine.save_settings
  end
end

Private Instance Methods

raw() click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 53
def raw
  @raw
end
raw=(new_raw) click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 57
def raw=(new_raw)
  @raw = new_raw
  raw_attributes = {}
  for key in [:adapter_type, :attachment_type, :bandwidth_limit, :boot_priority, :cable_connected, :enabled, :host_interface, :internal_network, :line_speed, :mac_address, :nat_driver, :nat_network, :slot, :trace_enabled, :trace_file]
    raw_attributes[key] = @raw.send(key)
  end
  merge_attributes(raw_attributes)
end
session() click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 66
def session
  ::VirtualBox::Lib.lib.session
end
with_session() { |session| ... } click to toggle source
# File lib/fog/virtual_box/models/compute/network_adapter.rb, line 70
def with_session
  raw_machine = machine.instance_variable_get(:@raw)
  raw_machine.lock_machine(session, :write)
  yield session
  session.unlock_machine
end