Sha256: 6a5031f4ae316df44f3d3c5783faebdff984fe695f6fb74dd163b1a1a5c6166e

Contents?: true

Size: 987 Bytes

Versions: 68

Compression:

Stored size: 987 Bytes

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def list_networks(filters = { })
          datacenter_name = filters[:datacenter]
          # default to show all networks
          only_active = filters[:accessible] || false
          raw_networks(datacenter_name).map do |network|
            next if only_active and !network.summary.accessible
            network_attributes(network, datacenter_name)
          end.compact
        end

        def raw_networks(datacenter_name)
          find_raw_datacenter(datacenter_name).network
        end

        protected

        def network_attributes network, datacenter
          {
            :id         => managed_obj_id(network),
            :name       => network.name,
            :accessible => network.summary.accessible,
            :datacenter => datacenter,
          }
        end

      end
      class Mock
        def list_networks(datacenter_name)
          []
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 9 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/vsphere/requests/compute/list_networks.rb
fog-1.20.0 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/vsphere/requests/compute/list_networks.rb
fog-1.19.0 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/vsphere/requests/compute/list_networks.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/vsphere/requests/compute/list_networks.rb