Class: Fog::Hyperv::Compute::Clusters

Inherits:
Fog::Hyperv::Collection show all
Defined in:
lib/fog/hyperv/compute/models/clusters.rb

Overview

A collection of clusters known by Hyper-V

Instance Method Summary collapse

Methods inherited from Fog::Hyperv::Collection

#all, get_method, #initialize, #new, requires, requires?

Constructor Details

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

Instance Method Details

#get(identifier, **filters) ⇒ Object

Get an instance of a cluster by name or id

Parameters:

  • identifier (String)

    the name or GUID of the cluster

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
# File 'lib/fog/hyperv/compute/models/clusters.rb', line 12

def get(identifier, **filters)
  id = identifier if identifier =~ /\A#{Fog::Hyperv::GUID}\z/i
  name = identifier unless id

  raise ArgumentError, 'Must provide a name or GUID' if (id.nil? || id.empty?) && (name.nil? || name.empty?)

  super(name:, _by_id: id, **filters)
end