Sha256: d44a5e3b25041d2d02d27069b692eceae50e41c0c01f609169ebd90c1e9cf8ed

Contents?: true

Size: 777 Bytes

Versions: 29

Compression:

Stored size: 777 Bytes

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def list_hosts(filters = {})
          cluster = get_raw_cluster(filters[:cluster], filters[:datacenter])
          cluster.host.map {|host| host_attributes(host, filters)}
        end

        protected

        def host_attributes(host, filters)
          {
            datacenter: filters[:datacenter],
            cluster:    filters[:cluster],
            name:       host[:name],
            vm_ids:     host[:vm].map {|vm| vm.config.instanceUuid }
          }
        end
      end
      class Mock
        def list_hosts(filters = {})
          self.data[:hosts].values.select {|r| r[:datacenter] == filters[:datacenter] && r[:cluster] == filters[:cluster]}
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
fog-vsphere-1.7.0.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.13.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.13.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.12.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.11.3 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.11.2 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.11.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.11.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.10.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.9.2 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.9.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.9.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.8.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.7.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.7.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.6.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.5.2 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.5.1 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.5.0 lib/fog/vsphere/requests/compute/list_hosts.rb
fog-vsphere-1.4.0 lib/fog/vsphere/requests/compute/list_hosts.rb