parameters

package
v0.0.0-...-0117b6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package parameters provides utilities to parse ssm document parameters

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToBool

func ConvertToBool(input interface{}) (result bool, err error)

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

func ReplaceParameter(input string, paramName string, paramValue string) string

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.

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.

func ValidParameters

func ValidParameters(log log.T, params map[string]interface{}) map[string]interface{}

ValidParameters checks if parameter names are valid. Returns valid parameters only.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL