Class: Fog::Compute::VirtualBox::NATRedirects

Inherits:
Fog::Collection show all
Defined in:
lib/fog/compute/models/virtual_box/nat_redirects.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, #requires_one

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/nat_redirects.rb', line 12

def machine
  @machine
end

#nat_engineObject

Returns the value of attribute nat_engine.



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

def nat_engine
  @nat_engine
end

Instance Method Details

#allObject



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

def all
  requires :machine, :nat_engine
  data = nat_engine.instance_variable_get(:@raw).redirects.map do |nat_redirect|
    {
      :machine  => machine,
      :raw      => nat_redirect
    }
  end
  load(data)
end

#get(nat_redirect_name) ⇒ Object



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

def get(nat_redirect_name)
  requires :machine, :nat_engine
  all.detect do |nat_redirect|
    nat_redirect.name == nat_redirect_name
  end
end

#new(attributes = {}) ⇒ Object



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

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