trigger

package
v0.0.0-...-bd111a6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METADATA      = "metadata"
	LABELS        = "labels"
	APIVERSION    = "apiVersion"
	KIND          = "kind"
	NAME          = "name"
	NAMESPACE     = "namespace"
	EVENT         = "event" // TODO: remove
	MESSAGE       = "message"
	HEADER        = "header"
	JOBID         = "jobid"
	TYPEINT       = "int"
	TYPEDOUBLE    = "double"
	TYPEBOOL      = "bool"
	TYPESTRING    = "string"
	TYPELIST      = "list"
	TYPEMAP       = "map"
	WEBHOOK       = "webhook"
	BODY          = "body"
	IF            = "if"
	SWITCH        = "switch"
	DEFAULT       = "default"
	EVENTSOURCE   = "eventSource"
	INPUT         = "input"
	OUTPUT        = "output"
	SETTINGS      = "settings"
	EVENTTRIGGERS = "eventTriggers"
	SYSTEMERROR   = "systemError"
	FUNCTIONS     = "functions"
)

constants for parsing

View Source
const (
	// IfFlag is flag for If statement
	IfFlag uint = 1 << iota
	// SwitchFlag is flag for switch statement
	SwitchFlag
	// DefaultFlag is flag for default statement
	DefaultFlag
	// BodyFlag is flag for body statement
	BodyFlag
)

Variables

This section is empty.

Functions

func GetTimestamp

func GetTimestamp() string

GetTimestamp Get timestamp. Timestamp format is UTC time expressed as:

YYYYMMDDHHMMSSL, where L is last digits in multiples of 1/10 second.

WARNING: This function may sleep up to 0.1 second per request if there are too many concurent requests

func ReadTriggerDefinition

func ReadTriggerDefinition(fileName string, td *EventTriggerDefinition) error

ReadTriggerDefinition reads the event trigger definition from a file.

func SubstituteTemplate

func SubstituteTemplate(templateStr string, variables interface{}) (string, error)

SubstituteTemplate replaces all values in a template.

Types

type EventTriggerDefinition

type EventTriggerDefinition struct {
	Setting       []map[interface{}]interface{}            // all settings
	EventTriggers map[string][]map[interface{}]interface{} // event source name to triggers
	Functions     map[string]map[interface{}]interface{}   // function name to function body
}

EventTriggerDefinition represents an event trigger definition

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor contains the event trigger definition and the file it was loaded from

func NewProcessor

func NewProcessor(env *endpoints.Environment) *Processor

NewProcessor creates a new trigger processor.

func (*Processor) Initialize

func (p *Processor) Initialize(dir string) error

Initialize initializes a Processor with the specified trigger directory

func (*Processor) ProcessMessage

func (p *Processor) ProcessMessage(message map[string]interface{}, eventSource string) ([]map[string]interface{}, error)

ProcessMessage processes an event message.

func (*Processor) StartListeners

func (p *Processor) StartListeners() error

StartListeners starts all event source listeners.

Jump to

Keyboard shortcuts

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