|
With the addition of the Init[T, arg, ...] data type it is possible to formalize and describe type casting of values.
This can be added to lookup_options to enable type casting. This is of value as there is no way to represent certain data types directly in JSON, YAML, etc. By adding the key data_type to lookup options, and setting either the desired type directly (for example Sensitive), or by setting it to an Init[T, arg,...arg] enables type casts of the looked up data to be performed by lookup before the value is returned.
If a simple data type is used (for example Sensitive) it is expected that this type has a single argument constructor that accepts the looked up value and returns an instance of the specified data type. If the constructor is more complex and needs additional arguments, or where its single argument constructor is not appropriate for the use case, an Init[T, args...] is instead used. (An example could be interpretation of a String in a particular format used to construct a time/date value).
The data_type entry in lookup_options is a String with a valid Puppet Type System specification of a data type.
|