cfpgen

package
v0.0.0-...-ad143a2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingInFile     = errors.New("Missing required argument -f")
	ErrMissingParameters = errors.New("Parameters not found in file")
)

Functions

func Generate

func Generate(c *Config, reader io.Reader) error

Generate generates a cloud formation parameters file template and writes either to a file or stdout

func RecurseArray

func RecurseArray(k string, slc []interface{}, container interface{})

RecurseArray converts types to supported types. Specifically interfaces stored in slices or the special case map[interface{}]interface{} yaml supports keys of arbitrary types whereas json does not, so we do this conversion to maintain compatibility between types

func RecurseMapInterface

func RecurseMapInterface(m map[interface{}]interface{}, newMap map[string]interface{})

RecurseMapInterface converts types to supported types. Specifically interfaces stored in slices or the special case map[interface{}]interface{} yaml supports keys of arbitrary types whereas json does not, so we do this conversion to maintain compatibility between types

Types

type Config

type Config struct {
	InFile                       string
	OutFile                      string
	Minimize                     bool
	Indent                       int
	Overwrite                    bool
	RemoveOldParamsNotInTemplate bool
	OutYaml                      bool
	InYaml                       bool
	Verbose                      bool
}

Config represents a config struct holding information about how to format output and where to write said output

func (*Config) GetParamList

func (c *Config) GetParamList(params map[string]interface{}) (ParamList, error)

GetParamList takes the given config and generates a ParamList ([]Parameter)

func (*Config) ProcessPL

func (c *Config) ProcessPL(pl ParamList) error

ProcessPL processes a ParamList and writes to a file or stdout

type ParamList

type ParamList []Parameter

ParamList is a slice of type Parameter

func (ParamList) Len

func (p ParamList) Len() int

Len implements the sort interface

func (ParamList) Less

func (p ParamList) Less(i, j int) bool

Less implements the sort interface

func (ParamList) Swap

func (p ParamList) Swap(i, j int)

Swap implements the sort interface

type Parameter

type Parameter struct {
	ParameterKey   string
	ParameterValue string
	Type           string        `yaml:"-" json:"-"`
	Description    string        `yaml:"-" json:"-"`
	AllowedValues  []interface{} `yaml:"-" json:"-"`
	Default        interface{}   `yaml:"-" json:"-"`
	AllowedPattern string        `yaml:"-" json:"-"`
}

Parameter represents a cloudformation Parameter

Jump to

Keyboard shortcuts

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