Class: Fog::Compute::OpenStack::Networks

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/compute/openstack/models/networks.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#destroy, #find_by_id, #get, #load_response, #summary

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/compute/openstack/models/networks.rb', line 12

def all
  requires :server

  networks = []
  server.addresses.each_with_index do |address, index|
    networks << {
      :id        => index + 1,
      :name      => address[0],
      :addresses => address[1].map { |a| a['addr'] }
    }
  end

  # TODO: convert to load_response?
  load(networks)
end