Puppet Function: dcos::domain

Defined in:
lib/puppet/functions/dcos/domain.rb
Function type:
Ruby 4.x API

Overview

dcos::domain(String $region, Optional[Optional[String]] $zone)Data type

Parameters:

  • arguments

    The original array of arguments. Port this to individually managed params to get the full benefit of the modern function API.

  • region (String)
  • zone (Optional[Optional[String]])

Returns:

  • (Data type)

    Describe what the function returns here



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet/functions/dcos/domain.rb', line 7

Puppet::Functions.create_function(:'dcos::domain') do
  # @param arguments
  #   The original array of arguments. Port this to individually managed params
  #   to get the full benefit of the modern function API.
  #
  # @return [Data type]
  #   Describe what the function returns here
  #
  dispatch :default_impl do
    required_param 'String', :region
    optional_param 'Optional[String]', :zone
  end

  def default_impl(region, zone = nil)
    conf = { 'fault_domain' => {} }

    if region
      conf['fault_domain']['region'] = { 'name' => region }
    end

    if zone
      conf['fault_domain']['zone'] = { 'name' => zone }
    end
    conf.to_json
  end
end