Parent types
These abstract data types are the parents of multiple other types, and match values that would match any of their sub-types. They’re useful when you have very loose restrictions but not no restrictions.
On this page:
The Scalar data type
The Scalar data type matches all values of the
following concrete data types:
Numbers (both integers and floats)
Strings
Booleans
Regular expressions
It doesn’t match undef, default, resource references, arrays, or hashes. It takes no
parameters.
Scalar is equivalent to Variant[Integer, Float, String, Boolean, Regexp].
The ScalarData data type
The ScalarData data type represents a restricted set of
"value" data types that have concrete direct representation in JSON.
ScalarData is an alias for Variant[Integer, Float, String,
Boolean].
The Data data type
The Data data type matches any value that would match
Scalar, but it also matches:
undefArrays that only contain values that also match
DataHashes whose keys match
Scalarand whose values also matchData
It doesn't match default or resource references. It
takes no parameters.
Data is especially useful because it represents the
subset of types that can be directly represented in almost all serialization format,
such as JSON.
The Collection data type
The Collection type matches any array or hash,
regardless of what kinds of values or keys it contains. It only partially overlaps with
Data— there are values, such as an array of resource
references, that match Collection but do not match
Data.
Collection is equivalent to Variant[Array[Any], Hash[Any, Any]].
The CatalogEntry data type
The CatalogEntry data type is the parent type of Resource and Class. Like
those types, the Puppet language contains no values that
it ever matches. However, the type Type[CatalogEntry]
matches any class reference or resource reference. It takes no parameters.
The Any data type
The Any data type matches any value of any
data type.
The Iterable data type
The Iterable data type represents all data types that can be iterated;
in other words, all data types where the value is some kind of container of individual
values. The Iterable type is abstract in that it does not specify if it
represents a concrete data type (such as Array) that has storage in
memory, of if it is an algorithmic construct like a transformation function (such as the
step function).
The Iterator data type
The Iterator data type is an Iterable that does not
have a concrete backing data type holding a copy of the values it will produce when
iterated over. It represents an algorithmic transformation of some source (which in turn
can be algorithmic).
An Iterator may not be assigned to an attribute of a
resource, and it may not be used as an argument to version 3.x functions. To create a
concrete value an Iterator must be "rolled out" by using
a function at the end of a chain that produces a concrete value.
The RichData data type
The RichData data type represents the abstract notion of
"serializeable" and includes all the types in the type system except
Runtime, Callable, Iterator, and
Iterable. It is expressed as an alias of Variant[Default, Object, Scalar, SemVerRange, Type, Undef, Array[RichData],
Hash[RichData, RichData]].