Documentation ¶
Index ¶
- func ApplyTemplate() bool
- func CanonicalPath(path string, basePath string) (string, error)
- func CanonicalPaths(paths []string, basePath string) ([]string, error)
- func CleanPath(path string) string
- func CommaSeparatedStrings(list []string) string
- func ConvertToMap(value interface{}, keys ...string) interface{}
- func CopyFile(source string, destination string) error
- func CopyFolderContents(source string, destination string) error
- func CreateLogger(prefix string) *logging.Logger
- func DeleteFiles(files []string) error
- func EncodeBase64Sha1(str string) string
- func ExpandArguments(args []interface{}, folder string) (result []interface{})
- func FileExists(path string) bool
- func FileStat(path string) (result os.FileInfo, err error)
- func GetLoggingLevel() logging.Level
- func GetPathRelativeTo(path, basePath string) (string, error)
- func GetPathRelativeToMax(path, basePath string, maxLevel uint) (result string)
- func GetPathRelativeToWorkingDir(path string) (result string)
- func GetPathRelativeToWorkingDirMax(path string, maxLevel uint) (result string)
- func GetRandomTime(lowerBound, upperBound time.Duration) time.Duration
- func GetSource(source, pwd string, logger *logging.Logger) (string, error)
- func GetTempDownloadFolder(folders ...string) string
- func Grep(regex *regexp.Regexp, glob string) (bool, error)
- func IndexOrDefault(list []string, index int, defVal string) string
- func InitLogging(levelName string, defaultLevel logging.Level, color bool) (int, error)
- func JoinPath(elem ...string) string
- func KindOf(value interface{}) reflect.Kind
- func ListContainsElement(list []string, element string) bool
- func ListContainsElementInterface(list []interface{}, element interface{}) bool
- func LoadDefaultValues(folder string) (result map[string]interface{}, err error)
- func LoadVariables(content string, cwd string, context ...interface{}) (map[string]interface{}, error)
- func LoadVariablesFromFile(path, cwd string, context ...interface{}) (map[string]interface{}, error)
- func LoadVariablesFromSource(content, fileName, cwd string, context ...interface{}) (result map[string]interface{}, err error)
- func PathContainsHiddenFileOrFolder(path string) bool
- func ReadFileAsString(path string) (string, error)
- func ReadFileAsStringFromSource(source, path string, logger *logging.Logger) (localFile, content string, err error)
- func RemoveDuplicatesFromList(list []string, keepLast bool, getKey func(key string) string) []string
- func RemoveDuplicatesFromListKeepFirst(list []string) []string
- func RemoveDuplicatesFromListKeepLast(list []string) []string
- func RemoveElementFromList(list []string, element string) []string
- func SetLoggingLevel(level int)
- func SplitEnvVariable(str string) (key, value string, err error)
- func WriteFileWithSamePermissions(source string, destination string, contents []byte) error
- type LogCatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTemplate ¶ added in v1.0.0
func ApplyTemplate() bool
ApplyTemplate determines if go template should be applied on terraform files.
func CanonicalPath ¶ added in v0.6.0
CanonicalPath returns the canonical version of the given path, relative to the given base path. That is, if the given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func CanonicalPaths ¶ added in v0.6.0
CanonicalPaths returns the canonical version of the given paths, relative to the given base path. That is, if a given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func CleanPath ¶ added in v0.9.0
CleanPath is used to clean paths to ensure the returned path uses / as the path separator to improve cross-platform compatibility.
func CommaSeparatedStrings ¶ added in v0.12.17
CommaSeparatedStrings returns an HCL compliant formated list of strings (each string within double quote)
func ConvertToMap ¶ added in v1.0.0
func ConvertToMap(value interface{}, keys ...string) interface{}
ConvertToMap builds a map with the keys supplied
func CopyFolderContents ¶ added in v0.9.4
CopyFolderContents copies the files and folders within the source folder into the destination folder. Note that hidden files and folders (those starting with a dot) will be skipped.
func CreateLogger ¶ added in v0.6.0
func CreateLogger(prefix string) *logging.Logger
CreateLogger creates a logger with the given prefix
func DeleteFiles ¶ added in v0.9.7
DeleteFiles deletes the given list of files. Note: this function ONLY deletes files and will return an error if you pass in a folder path.
func EncodeBase64Sha1 ¶ added in v0.9.7
EncodeBase64Sha1 returns the base 64 encoded sha1 hash of the given string
func ExpandArguments ¶ added in v1.0.0
func ExpandArguments(args []interface{}, folder string) (result []interface{})
ExpandArguments expands the list of arguments like x shell do
func FileExists ¶
FileExists returns true if the given file exists.
func FileStat ¶ added in v1.0.0
FileStat calls os.Stat with retries When multiple projects are running in parallel, the os.Stat() function returns 'bad file descriptor' if the file is being overwritten while being read.
func GetLoggingLevel ¶ added in v1.0.0
func GetLoggingLevel() logging.Level
GetLoggingLevel returns the current logging level
func GetPathRelativeTo ¶ added in v0.4.0
GetPathRelativeTo returns the relative path you would have to take to get from basePath to path
func GetPathRelativeToMax ¶ added in v1.0.0
GetPathRelativeToMax returns either an absolute path or a relative path if it is not too far from relatively to the base path
func GetPathRelativeToWorkingDir ¶ added in v1.0.0
GetPathRelativeToWorkingDir returns the path relative to the current working directory
func GetPathRelativeToWorkingDirMax ¶ added in v1.0.0
GetPathRelativeToWorkingDirMax returns either an absolute path or a relative path if it is not too far from relatively to the current directory
func GetRandomTime ¶ added in v0.6.4
GetRandomTime returns random time duration between the lower bound and upper bound. This is useful because some of our
automated tests wound up flooding the AWS API all at once, leading to a "Subscriber limit exceeded" error.
TODO: Some of the more exotic test cases fail, but it's not worth catching them given the intended use of this function.
func GetSource ¶ added in v1.0.0
GetSource gets the content of the source in a temporary folder and returns the local path. The function manages a cache to avoid multiple remote calls if the content has not changed
func GetTempDownloadFolder ¶ added in v1.0.0
GetTempDownloadFolder returns the fo
func Grep ¶
Grep returns true if the given regex can be found in any of the files matched by the given glob
func IndexOrDefault ¶ added in v1.0.0
IndexOrDefault returns the item at index position or default value if the array is shorter than index
func InitLogging ¶ added in v1.0.0
InitLogging must be called to set the logging string, initialize color and logging level
func JoinPath ¶ added in v0.9.0
JoinPath always use / as the separator. Windows systems use \ as the path separator *nix uses / Use this function when joining paths to force the returned path to use / as the path separator This will improve cross-platform compatibility
func ListContainsElement ¶ added in v0.6.0
ListContainsElement returns true if the given list contains the given element
func ListContainsElementInterface ¶ added in v1.0.0
func ListContainsElementInterface(list []interface{}, element interface{}) bool
ListContainsElementInterface returns true if the given list contains the given element
func LoadDefaultValues ¶ added in v1.0.0
LoadDefaultValues returns a map of the variables defined in the tfvars file
func LoadVariables ¶ added in v1.0.0
func LoadVariables(content string, cwd string, context ...interface{}) (map[string]interface{}, error)
LoadVariables returns a map of the variables defined in the content provider
func LoadVariablesFromFile ¶ added in v1.0.0
func LoadVariablesFromFile(path, cwd string, context ...interface{}) (map[string]interface{}, error)
LoadVariablesFromFile returns a map of the variables defined in the tfvars file
func LoadVariablesFromSource ¶ added in v1.0.0
func LoadVariablesFromSource(content, fileName, cwd string, context ...interface{}) (result map[string]interface{}, err error)
LoadVariablesFromSource returns a map of the variables defined in the content provider
func PathContainsHiddenFileOrFolder ¶ added in v0.12.22
PathContainsHiddenFileOrFolder returns true if folder contains files starting with . (except . and ..)
func ReadFileAsString ¶ added in v0.4.0
ReadFileAsString returns the contents of the file at the given path as a string
func ReadFileAsStringFromSource ¶ added in v1.0.0
func ReadFileAsStringFromSource(source, path string, logger *logging.Logger) (localFile, content string, err error)
ReadFileAsStringFromSource returns the contents of the file at the given path from an external source (github, s3, etc.) as a string It uses terraform to execute its command
func RemoveDuplicatesFromList ¶ added in v0.12.11
func RemoveDuplicatesFromList(list []string, keepLast bool, getKey func(key string) string) []string
RemoveDuplicatesFromList returns a copy of the given list with all duplicates removed (keeping the last encountereds) Params:
list: The list to filter keepLast: Indicates whether the last or first encountered duplicate element should be kept getKey: Function used to extract the actual key from the string
func RemoveDuplicatesFromListKeepFirst ¶ added in v1.0.0
RemoveDuplicatesFromListKeepFirst returns a copy of the given list with all duplicates removed (keeping the first encountereds)
func RemoveDuplicatesFromListKeepLast ¶ added in v0.12.11
RemoveDuplicatesFromListKeepLast returns a copy of the given list with all duplicates removed (keeping the last encountereds)
func RemoveElementFromList ¶ added in v0.6.0
RemoveElementFromList returns a copy of the given list with all instances of the given element removed
func SetLoggingLevel ¶ added in v1.0.0
func SetLoggingLevel(level int)
SetLoggingLevel sets the logging level
func SplitEnvVariable ¶ added in v1.0.0
SplitEnvVariable returns the two parts of an environment variable
Types ¶
type LogCatcher ¶ added in v1.0.0
type LogCatcher struct { Writer io.Writer Logger *logging.Logger // contains filtered or unexported fields }
LogCatcher traps messsage containing logging level [LOGLEVEL] and redirect them to the logging system
func (*LogCatcher) Close ¶ added in v1.2.4
func (catcher *LogCatcher) Close() error
Close implements io.Closer