mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
4d33ccb7a7
- Focus on adding additional vm actions support - New request types are not fully tested
29 lines
692 B
Ruby
29 lines
692 B
Ruby
require 'fog/core/collection'
|
|
require 'fog/openstack/models/compute/network'
|
|
|
|
module Fog
|
|
module Compute
|
|
class OpenStack
|
|
class Networks < Fog::Collection
|
|
model Fog::Compute::OpenStack::Network
|
|
|
|
attribute :server
|
|
|
|
def all
|
|
requires :server
|
|
|
|
networks = Array.new
|
|
server.addresses.each_with_index do |address, index|
|
|
networks << {
|
|
:id => index + 1,
|
|
:name => address[0],
|
|
:addresses => address[1].map {|a| a['addr'] }
|
|
}
|
|
end
|
|
|
|
load(networks)
|
|
end
|
|
end # class Networks
|
|
end # class OpenStack
|
|
end # module Compute
|
|
end # module Fog
|