Puppet Function: dcos::resources

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

Overview

dcos::resources(Any $resources)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.

  • resources (Any)

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
# File 'lib/puppet/functions/dcos/resources.rb', line 7

Puppet::Functions.create_function(:'dcos::resources') 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 'Any', :resources
  end

  def default_impl(resources)
    mesos_res = []
    resources.each do |k, v|
      value = v.dup
      value['name'] = k
      mesos_res << value
    end

    mesos_res.to_json
  end
end