Puppet Function: nsd::flatten_acl

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

Overview

nsd::flatten_acl(Variant[NSD::ACL::AllowNotify, NSD::ACL::Notify, NSD::ACL::ProvideXFR, NSD::ACL::RequestXFR] $value)String

Flatten an ACL type to its string form.

Examples:

nsd::flatten_acl(['127.0.0.1', 'NOKEY'])

Parameters:

  • value (Variant[NSD::ACL::AllowNotify, NSD::ACL::Notify, NSD::ACL::ProvideXFR, NSD::ACL::RequestXFR])

    The ACL to flatten.

Returns:

  • (String)

    The flattened string.

Since:

  • 2.0.0



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'functions/flatten_acl.pp', line 11

function nsd::flatten_acl(Variant[NSD::ACL::AllowNotify, NSD::ACL::Notify, NSD::ACL::ProvideXFR, NSD::ACL::RequestXFR] $value) {

  $value ? {
    undef   => undef,
    default => type($value) ? {
      Type[NSD::ACL::Notify]     => type($value[0]) ? {
        Type[Tuple] => "${value[0][0]}@${value[0][1]} ${value[1]}",
        default     => "${value[0]} ${value[1]}",
      },
      Type[NSD::ACL::RequestXFR] => type($value[1]) ? {
        Type[Tuple] => "${value[0]} ${value[1][0]}@${value[1][1]} ${value[2]}",
        default     => "${value[0]} ${value[1]} ${value[2]}",
      },
      default                    => type($value[0]) ? {
        Type[Tuple] => type($value[0][1]) ? {
          Type[Bodgitlib::Port] => "${value[0][0]}@${value[0][1]} ${value[1]}",
          default               => size($value[0]) ? {
            2       => type($value[0][1]) ? {
              Type[Bodgitlib::Netmask] => "${value[0][0]}&${value[0][1]} ${value[1]}",
              default                  => "${value[0][0]}-${value[0][1]} ${value[1]}",
            },
            default => type($value[0][1]) ? {
              Type[Bodgitlib::Netmask] => "${value[0][0]}&${value[0][1]}@${value[0][2]} ${value[1]}",
              default                  => "${value[0][0]}-${value[0][1]}@${value[0][2]} ${value[1]}",
            },
          },
        },
        default     => "${value[0]} ${value[1]}",
      },
    },
  }
}