Sha256: 1f9abcf4db19b80da65a0f2d2324006281ce0569351fb8280c0f6a8ef464845a

Contents?: true

Size: 532 Bytes

Versions: 23

Compression:

Stored size: 532 Bytes

Contents

module Fog
  module Vsphere
    class Compute
      class Hosts < Fog::Collection
        attribute :datacenter
        attribute :cluster

        model Fog::Vsphere::Compute::Host

        def all(_filters = {})
          requires :datacenter, :cluster
          load service.list_hosts(datacenter: datacenter, cluster: cluster)
        end

        def get(name)
          all.find { |host| host.name == name } ||
            raise(Fog::Vsphere::Compute::NotFound, "no such host #{name}")
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.1.1 lib/fog/vsphere/models/compute/hosts.rb
fog-vsphere-3.1.0 lib/fog/vsphere/models/compute/hosts.rb
fog-vsphere-3.0.0 lib/fog/vsphere/models/compute/hosts.rb