* [`apt::ppa`](#defined-type-aptppa)
* [`apt::setting`](#defined-type-aptsetting)
* [`apt::source`](#defined-type-aptsource)
+* [`apt::proxy`](#defined-type-aptproxy)
### Types
* `ppas`: Creates new `apt::ppa` resources. Valid options: a hash to be passed to the [`create_resources` function](https://docs.puppetlabs.com/references/latest/function.html#createresources). Default: {}.
-* `proxy`: Configures Apt to connect to a proxy server. Valid options: a hash made up from the following keys:
-
- * `host`: Specifies a proxy host to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: a string containing a hostname. Default: undef.
-
- * `port`: Specifies a proxy port to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: an integer containing a port number. Default: 8080.
-
- * `https`: Specifies whether to enable https proxies. Valid options: `true` and `false`. Default: `false`.
-
- * `ensure`: Optional parameter. Valid options: 'file', 'present', and 'absent'. Default: `undef`. Prefer 'file' over 'present'.
-
- * `direct`: Specifies whether or not to use a 'DIRECT' https proxy if http proxy is used but https is not. Valid options: `true` and `false`. Default: `false`.
+* `proxy`: Configures Apt to connect to a proxy server. Valid options: a hash matching the locally defined type [`apt::proxy`](#defined-type-aptproxy).
* `purge`: Specifies whether to purge any existing settings that aren't managed by Puppet. Valid options: a hash made up from the following keys:
All parameters are optional.
-* `content`: Supplies the entire GPG key. Useful in case the key can't be fetched from a remote location and using a file resource is inconvenient. Cannot be used in combination with `source`. Valid options: a string. Default: undef.
+* `content`: Supplies the entire GPG key. Useful in case the key can't be fetched from a remote location and using a file resource is inconvenient. Cannot be used in combination with `source`. Valid options: a string. Default: `undef`.
-* `options`: Passes additional options to `apt-key adv --keyserver-options`. Valid options: a string. Default: undef.
+* `options`: Passes additional options to `apt-key adv --keyserver-options`. Valid options: a string. Default: `undef`.
+
+* `server`: Specifies a keyserver to provide Puppet's GPG key. Valid options: a string containing a domain name or a full URL. Default: `keyserver.ubuntu.com`.
+
+* `source`: Specifies the location of an existing GPG key file to copy. Cannot be used in combination with `content`. Valid options: a string containing a URL (ftp://, http://, or https://) or an absolute path. Default: `undef`.
+
+#### Defined Type: `apt::proxy`
+
+Configures Apt to connect to a proxy server.
+
+##### Parameters
+
+All parameters are optional.
+
+* `host`: *Optional.* Specifies a proxy host to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: a string containing a hostname. Default: `undef`.
+
+* `port`: *Optional.* Specifies a proxy port to be stored in `/etc/apt/apt.conf.d/01proxy`. Valid options: an integer containing a port number. Default: `8080`.
+
+* `https`: *Optional.* Specifies whether to enable https proxies. Valid options: `true` and `false`. Default: `false`.
-* `server`: Specifies a keyserver to provide Puppet's GPG key. Valid options: a string containing a domain name or a full URL. Default: 'keyserver.ubuntu.com'.
+* `direct`: *Optional.* Specifies whether or not to use a `DIRECT` https proxy if http proxy is used but https is not. Valid options: `true` and `false`. Default: `false`.
-* `source`: Specifies the location of an existing GPG key file to copy. Cannot be used in combination with `content`. Valid options: a string containing a URL (ftp://, http://, or https://) or an absolute path. Default: undef.
+* `ensure`: *Optional.* Specifies whether the proxy should exist. Valid options: 'file', 'present', and 'absent'. Default: undef. Prefer 'file' over 'present'.
## Limitations
Hash $confs = $apt::params::confs,
Hash $update = $apt::params::update,
Hash $purge = $apt::params::purge,
- Hash $proxy = $apt::params::proxy,
+ Apt::Proxy $proxy = $apt::params::proxy,
Hash $sources = $apt::params::sources,
Hash $keys = $apt::params::keys,
Hash $ppas = $apt::params::ppas,
}
$_purge = merge($::apt::purge_defaults, $purge)
-
- if $proxy['ensure'] {
- assert_type(Enum['file', 'present', 'absent'], $proxy['ensure'])
- }
- if $proxy['host'] {
- assert_type(String, $proxy['host'])
- }
- if $proxy['port'] {
- assert_type(Integer, $proxy['port'])
- }
- if $proxy['https']{
- assert_type(Boolean, $proxy['https'])
- }
- if $proxy['direct']{
- assert_type(Boolean, $proxy['direct'])
- }
-
$_proxy = merge($apt::proxy_defaults, $proxy)
$confheadertmp = epp('apt/_conf_header.epp')
--- /dev/null
+type Apt::Proxy = Struct[
+ {
+ ensure => Optional[Enum['file', 'present', 'absent']],
+ host => Optional[String],
+ port => Optional[Integer[0, 65535]],
+ https => Optional[Boolean],
+ direct => Optional[Boolean],
+ }
+]