Documentation ¶
Overview ¶
Package trigger provides functionality that help manipulate stacks triggers.
Index ¶
Constants ¶
const ( // ErrTrigger indicates an error happened while triggering the stack. ErrTrigger errors.Kind = "trigger failed" // ErrParsing indicates an error happened while parsing the trigger file. ErrParsing errors.Kind = "parsing trigger file" )
const (
// DefaultContext is the default context for the trigger file when not specified.
DefaultContext = "stack"
)
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates a trigger for a stack with the given path and the given reason inside the project rootdir.
Types ¶
type Info ¶
type Info struct { // Ctime is unix timestamp of when the trigger was created. Ctime int64 // Reason is the reason why the trigger was created, if any. Reason string // Type is the trigger type. Type Kind // Context is the context of the trigger (only `stack` at the moment) Context string // StackPath is the path of the triggered stack. StackPath project.Path }
Info represents the parsed contents of a trigger.
func Is ¶ added in v0.9.0
func Is(root *config.Root, filename project.Path) (info Info, stack project.Path, exists bool, err error)
Is checks if the filename is a trigger file and if that's the case then it returns the parsed trigger info and the triggered path. If the trigger file exists, the exists returns true. If the file is not inside the triggerDir then it returns an empty Info, empty path, false and no error. If there's an error parsing the trigger file, it returns empty info, true and the error. It only parses the file if it's inside the triggers directory (.tmtriggers).