|
47 | 47 | # ensure => present,
|
48 | 48 | # }
|
49 | 49 | define nginx::resource::streamhost (
|
50 |
| - $ensure = 'present', |
51 |
| - $listen_ip = '*', |
52 |
| - $listen_port = 80, |
53 |
| - $listen_options = undef, |
54 |
| - $ipv6_enable = false, |
55 |
| - $ipv6_listen_ip = '::', |
56 |
| - $ipv6_listen_port = 80, |
57 |
| - $ipv6_listen_options = 'default ipv6only=on', |
58 |
| - $proxy = undef, |
59 |
| - $proxy_read_timeout = $::nginx::proxy_read_timeout, |
60 |
| - $proxy_connect_timeout = $::nginx::proxy_connect_timeout, |
61 |
| - $resolver = [], |
62 |
| - $raw_prepend = undef, |
63 |
| - $raw_append = undef, |
64 |
| - $owner = $::nginx::global_owner, |
65 |
| - $group = $::nginx::global_group, |
66 |
| - $mode = $::nginx::global_mode, |
| 50 | + Enum['absent', 'present'] $ensure = 'present', |
| 51 | + Variant[Array, String] $listen_ip = '*', |
| 52 | + Integer $listen_port = 80, |
| 53 | + Optional[String] $listen_options = undef, |
| 54 | + Boolean $ipv6_enable = false, |
| 55 | + Variant[Array, String] $ipv6_listen_ip = '::', |
| 56 | + Integer $ipv6_listen_port = 80, |
| 57 | + String $ipv6_listen_options = 'default ipv6only=on', |
| 58 | + $proxy = undef, |
| 59 | + String $proxy_read_timeout = $::nginx::proxy_read_timeout, |
| 60 | + $proxy_connect_timeout = $::nginx::proxy_connect_timeout, |
| 61 | + Array $resolver = [], |
| 62 | + $raw_prepend = undef, |
| 63 | + $raw_append = undef, |
| 64 | + String $owner = $::nginx::global_owner, |
| 65 | + String $group = $::nginx::global_group, |
| 66 | + String $mode = $::nginx::global_mode, |
67 | 67 | ) {
|
68 | 68 |
|
69 |
| - validate_re($ensure, '^(present|absent)$', |
70 |
| - "${ensure} is not supported for ensure. Allowed values are 'present' and 'absent'.") |
71 |
| - if !(is_array($listen_ip) or is_string($listen_ip)) { |
72 |
| - fail('$listen_ip must be a string or array.') |
73 |
| - } |
74 |
| - if is_string($listen_port) { |
75 |
| - warning('DEPRECATION: String $listen_port must be converted to an integer. Integer string support will be removed in a future release.') |
76 |
| - } |
77 |
| - elsif !is_integer($listen_port) { |
78 |
| - fail('$listen_port must be an integer.') |
79 |
| - } |
80 |
| - if ($listen_options != undef) { |
81 |
| - validate_string($listen_options) |
82 |
| - } |
83 |
| - validate_bool($ipv6_enable) |
84 |
| - if !(is_array($ipv6_listen_ip) or is_string($ipv6_listen_ip)) { |
85 |
| - fail('$ipv6_listen_ip must be a string or array.') |
86 |
| - } |
87 |
| - if is_string($ipv6_listen_port) { |
88 |
| - warning('DEPRECATION: String $ipv6_listen_port must be converted to an integer. Integer string support will be removed in a future release.') |
89 |
| - } |
90 |
| - elsif !is_integer($ipv6_listen_port) { |
91 |
| - fail('$ipv6_listen_port must be an integer.') |
92 |
| - } |
93 |
| - validate_string($ipv6_listen_options) |
94 |
| - |
95 |
| - validate_string($proxy_read_timeout) |
96 |
| - |
97 |
| - validate_array($resolver) |
98 |
| - |
99 |
| - validate_string($owner) |
100 |
| - validate_string($group) |
101 |
| - validate_re($mode, '^\d{4}$', |
102 |
| - "${mode} is not valid. It should be 4 digits (0644 by default).") |
103 |
| - |
104 | 69 | # Variables
|
105 | 70 | if $::nginx::confd_only {
|
106 | 71 | $streamhost_dir = "${::nginx::conf_dir}/conf.stream.d"
|
|
0 commit comments