File: dump_config.pp

package info (click to toggle)
puppet-module-jhbigler-vector 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 388 kB
  • sloc: ruby: 511; sh: 67; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# vector::dump_config
#
# @param data
#   A puppet hash representing the configuration of some vector entity (source, transform, sink, etc)
# @param format
#   What format to dump the $data parameter as (json, toml, yaml, yml)
#
# @return
#   A String representing the dumped configuration
function vector::dump_config(
  Hash $data,
  Vector::ValidConfigFormat $format = 'toml',
) >> String {
  case $format {
    /ya?ml/ : { to_yaml($data) }
    'toml'  : { to_toml($data) }
    default : { to_json($data) }
  }
}