parameters

package
v0.0.0-...-3f59448 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

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

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

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.

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