Sha256: c3c39466776b0c2e4c81af271e6338d70f07e2d51e800986d0468adf35fe8034

Contents?: true

Size: 724 Bytes

Versions: 5

Compression:

Stored size: 724 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/network/network'

module Fog
  module Network
    class OpenStack
      class Networks < Fog::Collection
        attribute :filters

        model Fog::Network::OpenStack::Network

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load(service.list_networks(filters).body['networks'])
        end

        def get(network_id)
          if network = service.get_network(network_id).body['network']
            new(network)
          end
        rescue Fog::Network::OpenStack::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-1.31.0 lib/fog/openstack/models/network/networks.rb
fog-1.30.0 lib/fog/openstack/models/network/networks.rb
fog-1.29.0 lib/fog/openstack/models/network/networks.rb
fog-1.28.0 lib/fog/openstack/models/network/networks.rb
fog-1.27.0 lib/fog/openstack/models/network/networks.rb