commands

package
v0.82.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// gentime function maps
	GenTimeFunctions = template.FuncMap{

		"add": func(a int, b int) int {
			log.Debug("Calling Template Function [add] with arguments: %s + %s", a, b)
			return a + b
		},

		"strip": func(s string, rmv string) string {
			log.Debug("Calling Template Function [strip] with arguments: (%s, %s) ", s, rmv)
			return strings.Replace(s, rmv, "", -1)
		},

		"cat": func(path string) string {
			log.Debug("Calling Template Function [cat] with arguments: %s", path)
			b, err := ioutil.ReadFile(path)
			utils.HandleError(err)
			return string(b)
		},

		"literal": literal,

		"suffix": suffix,

		"prefix": prefix,

		"contains": contains,

		"loop": loop,

		"GET": httpGet,

		"s3_read": s3Read,

		"invoke": lambdaInvoke,

		"kms_encrypt": kmsEncrypt,

		"kms_decrypt": kmsDecrypt,

		"mod": func(a int, b int) int {
			log.Debug("Calling Template Function [mod] with arguments: %s % %s", a, b)
			return a % b
		},

		"seq": func(from, to int) []int {
			log.Debug("Calling Template Function [seq] with arguments: %s % %s", from, to)
			seq := make([]int, to-from+1)
			for i := range seq {
				seq[i] = from + i
			}
			return seq
		},

		"title": func(s string) string {
			log.Debug("Calling Template Function [title] with arguments: %s", s)
			return strings.Title(s)
		},
	}

	// deploytime function maps
	DeployTimeFunctions = template.FuncMap{

		"suffix": suffix,

		"prefix": prefix,

		"contains": contains,

		"loop": loop,

		"literal": literal,

		"GET": httpGet,

		"s3_read": s3Read,

		"invoke": lambdaInvoke,

		"kms_encrypt": kmsEncrypt,

		"kms_decrypt": kmsDecrypt,
	}
)

Common Functions - Both Deploy/Gen

View Source
var (
	// RootCmd command (calls all other commands)
	RootCmd = &cobra.Command{
		Use:   "qaz",
		Short: version,
		Run: func(cmd *cobra.Command, args []string) {

			if run.version {
				fmt.Printf("qaz - Version %s"+"\n", version)
				return
			}

			cmd.Help()
		},
	}
)

Functions

func Configure

func Configure(confSource string, conf string) (stks stacks.Map, err error)

Configure parses the config file and string and returns a stacks.Map

func GetSession

func GetSession(options ...func(*session.Options)) (*session.Session, error)

GetSession - Returns aws session based on default run.profile and run.Region options can be overwritten by passing a function: func(*session.Options)

Types

type TemplateFunctionDesc

type TemplateFunctionDesc struct {
	Name  string
	Desc  string
	Type  string
	Usage string
}

TemplateFunctionDesc -describes template functions

Jump to

Keyboard shortcuts

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