Documentation
¶
Overview ¶
Package parameters provides utilities to parse ssm document parameters
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceParameter ¶
ReplaceParameter replaces all occurrences of "{{ paramName }}" in the input by paramValue.
Example ¶
fmt.Println(ReplaceParameter("A {{ p1 }} is a {{ p1 }}.", "p1", "name"))
Output: A name is a name.
func ReplaceParameters ¶
func ReplaceParameters(input interface{}, parameters map[string]interface{}, logger log.T) interface{}
ReplaceParameters traverses an arbitrarily complex input object (maps/slices/strings/etc.) and tries to replace parameters given as {{parameter}} with their values from the parameters map.
Strings like "{{ parameter }}" are replaced directly with the value associated with the parameter. That value need not be a string.
Strings like "a {{ parameter1 }} within a string" are replaced with strings where the parameters are replaced by a marshaled version of their values. In this case, the resulting object is always a string.
Note: this only works on composite types []interface{} and map[string]interface{} which are what json.Unmarshal produces by default. If your object contains []string, for example, the object will be returned as is.
Returns a new object with replaced parameters.
Types ¶
This section is empty.