Puppet Function: openldap::flatten_limits

Defined in:
functions/flatten_limits.pp
Function type:
Puppet Language

Overview

openldap::flatten_limits(Optional[Array[OpenLDAP::Limit, 1]] $values)Optional[Array[String, 1]]

Flatten an array of combined size and time limit specifications to an array of strings.

Examples:

openldap::flatten_limits([{'selector' => 'users', 'size' => 'unlimited', 'time' => 'unlimited'}])

Parameters:

  • values (Optional[Array[OpenLDAP::Limit, 1]])

    The array of limits to flatten, undef is passed through.

Returns:

  • (Optional[Array[String, 1]])

    The array of flattened strings.

Since:

  • 2.0.0



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'functions/flatten_limits.pp', line 11

function openldap::flatten_limits(Optional[Array[OpenLDAP::Limit, 1]] $values) {

  $values ? {
    undef   => undef,
    default => $values.map |OpenLDAP::Limit $value| {
      join(delete_undef_values([
        $value['selector'],
        type($value['size']) ? {
          Type[Scalar] => "size=${value['size']}",
          default      => openldap::flatten_size_limit($value['size']),
        },
        type($value['time']) ? {
          Type[Scalar] => "time=${value['time']}",
          default      => openldap::flatten_time_limit($value['time']),
        },
      ]), ' ')
    }
  }
}