1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/models/network/networks.rb

25 lines
544 B
Ruby
Raw Normal View History

require 'fog/core/collection'
require 'fog/openstack/models/network/network'
module Fog
module Network
class OpenStack
class Networks < Fog::Collection
model Fog::Network::OpenStack::Network
def all
load(connection.list_networks.body['networks'])
end
def get(network_id)
if network = connection.get_network(network_id).body['network']
new(network)
end
rescue Fog::Network::OpenStack::NotFound
nil
end
end
end
end
end