generic

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(command string) error

func GenerateFileFromTemplate

func GenerateFileFromTemplate(templatedFilePath string, templateArgs interface{}) (string, error)

GenerateFileFromTemplate applies the template defined in templatedFilePath to templateArgs. The generated file will be named 'generated_<templated-file-base>' and it will be created in the same directory of the template.

func RunCommand

func RunCommand(command string, args, successOrFail string) error

func TemplateArgumentsToMap

func TemplateArgumentsToMap(templateArguments ...TemplateArgument) (map[string]string, error)

TemplateArgumentsToMap uses the elements of 'templateArguments' to populate the key:value pairs of the returned map. The key is the '.Key' variable of the corresponding element, and the value is the string returned by the 'GetValue' method of said element.

func WaitFor

func WaitFor(duration int, durationUnits string) error

Types

type TemplateArgument

type TemplateArgument struct {
	Key                 string
	EnvironmentVariable string
	Default             string
	Mandatory           bool
}

func (TemplateArgument) GetValue

func (ta TemplateArgument) GetValue() (string, error)

GetValue returns the value of the Environment Variable defined by 'TemplateArgument.EnvironmentVariable'. If 'TemplateArgument.EnvironmentVariable' is empty or the ENV. VAR. it defines is unset, 'TemplateArgument.Default' is returned. That is, if 'TemplateArgument.Mandatory' is not 'true', in which case, an error is returned.

Jump to

Keyboard shortcuts

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