Class: Fog::Hyperv::Compute::Cluster

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/hyperv/compute/models/cluster.rb

Overview

A cluster known to Hyper-V

This model is read-only and strictly informative

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize, #merge_attributes

Methods included from ModelExtends

#collection

Methods included from ModelIncludes

#cluster, #computer, #dirty, #dirty?, #vm

Constructor Details

This class inherits a constructor from Fog::Hyperv::Model

Instance Attribute Details

#descriptionString (readonly)

Returns the description of the cluster.

Returns:

  • (String)

    the description of the cluster



14
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 14

attribute :description, type: :string

#domainString (readonly)

Returns the domain of the cluster.

Returns:

  • (String)

    the domain of the cluster



17
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 17

attribute :domain, type: :string

#hostsObject (readonly)



24
25
26
27
28
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 24

def hosts
  return [] unless persisted?

  cluster_nodes.map { |n| service.hosts.get(n[:name]) }
end

#idString (readonly)

Returns the GUID of the cluster.

Returns:

  • (String)

    the GUID of the cluster



10
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 10

identity :id, type: :string

#nameString (readonly)

Returns the name of the cluster.

Returns:

  • (String)

    the name of the cluster



20
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 20

attribute :name, type: :string

Instance Method Details

#reloadObject

Reload the cluster information from Hyper-V



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/hyperv/compute/models/cluster.rb', line 31

def reload
  requires :id

  data = service.get_cluster(
    id:,

    _return_fields: self.class.attributes
  )
  return unless data

  merge_attributes(data.attributes)
end