Policy Template Language Functions
Functions make it possible to compute values dynamically, for example by concatenating multiple values together or extracting sub-text from an API response. The syntax for calling a function is:
<function>(<term>, <term>, …)
For example:
size($volumes)
Functions can accept a number of basic types as parameters. These basic types strongly parallel what you might find in JSON or JavaScript:
- Number—a number can be an integer or floating point value.
- String—a string value, denoted with ""
- Boolean—true or false.
- Regexp—a regular expression value. Always denoted in the language with // brackets. For example, the function which accepts a Regexp might be called like
contains("hello world", /hello/)
- Array—an array of any of the other values.
- Object—an object is a hash or map of values. See the policy template language Syntax for details.
- Datasource, Resource—Datasources and resources are treated as an array of objects if used as a parameter to a function
Click the appropriate link below to learn more about a specific function: