Documentation ¶
Overview ¶
Package parameters provides utilities to parse ssm document parameters
Index ¶
- func ConvertToBool(input interface{}) (result bool, err error)
- func ReplaceParameter(input string, parameters map[string]interface{}, logger log.T) string
- func ReplaceParameters(input interface{}, parameters map[string]interface{}, logger log.T) interface{}
- func ValidParameters(log log.T, params map[string]interface{}) map[string]interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToBool ¶
convertToString converts the input to a bool form: if already a bool, returns the same object, if it's a string, parse bool from it, otherwise error
func ReplaceParameter ¶
ReplaceParameter replaces all occurrences of "{{ paramName }}" in the input by paramValue. This method should be called only on parameter names that have been validated first. this method replace all parameters all in once. i.e. if a parameter has value which is another parameter, we won't recusively replace that value again
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.