eventcel

package
v0.0.0-...-88a3487 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 23 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"
	HTML_URL      = "html_url"
	REPOSITORY    = "repository"
	REF           = "ref"

	APPSODY_CONFIG_YAML                 = ".appsody-config.yaml"
	DEVFILE                             = "devfile.yaml"
	STACK                               = "stack"
	WEBHOOKS_TEKTON_GIT_SERVER_VARIABLE = "body.webhooks-tekton-git-server"
	WEBHOOKS_TEKTON_GIT_ORG_VARIABLE    = "body.webhooks-tekton-git-org"
	WEBHOOKS_TEKTON_GIT_REPO_VARIABLE   = "body.webhooks-tekton-git-repo"
	WEBHOOKS_TEKTON_GIT_BRANCH_VARIABLE = "body.webhooks-tekton-git-branch"
	WEBHOOKS_TEKTON_EVENT_TYPE_VARIABLE = "body.webhooks-tekton-event-type"
	WEBHOOKS_TEKTON_TAG_SHA             = "body.webhooks-tekton-sha"
	WEBHOOKS_TEKTON_TAG_VERSION         = "body.webhooks-tekton-tag-version"
	//    WEBHOOKS_TEKTON_MONITOR_VARIABLE = "body.webhooks-tekton-monitor"
	WEBHOOKS_KABANERO_TEKTON_LISTENER      = "body.webhooks-kabanero-tekton-listener"
	WEBHOOKS_TEKTON_GITHUB_SECRET_NAME     = "body.webhooks-tekton-github-secret-name"
	WEBHOOKS_TEKTON_GITHUB_SECRET_KEY_NAME = "body.webhooks-tekton-github-secret-key-name"
	WEBHOOKS_TEKTON_TARGET_NAMESPACE       = "body.webhooks-tekton-target-namespace"
	UNKNOWN_LISTENER                       = "http://UNKNOWN_KABAKERO_TEKTON_LISTENER"
	HEADS                                  = "heads"
	HEAD                                   = "head"
	TAGS                                   = "tags"
	TAG                                    = "tag"
	PULL_REQUEST                           = "pull_request"
	PUSH                                   = "push"
	AFTER                                  = "after"
)

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 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 GetEventFunctionHandler

type GetEventFunctionHandler func(name string) *eventsv1alpha1.EventFunctionImpl

Handler to find event function given function name

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(functionHandler GetEventFunctionHandler, sendHandler SendEventHandler) *Processor

NewProcessor creates a new trigger processor.

func (*Processor) EvaluateString

func (p *Processor) EvaluateString(val string) (string, error)

Evaluate an expressions that should result in a string

func (*Processor) GetStatusParameters

func (processor *Processor) GetStatusParameters() []eventsv1alpha1.EventStatusParameter

func (*Processor) ProcessMessage

func (p *Processor) ProcessMessage(header map[string][]string, body map[string]interface{}, mediator *eventsv1alpha1.EventMediator, mediation *eventsv1alpha1.EventMediationImpl,
	hasRepoType bool, repoTypeValue map[string]interface{}, namespace string, client client.Client, kabaneroIntegration bool, remoteAddr string) error
ProcessMessage processes an event message.

Input:

header: header of message
body: body of message
mediation: mediation to process the message
hasRepoType: true if RepositoryType is specified for the mediation
repoTypeValue: the value of the yaml file specified by the RepositoryType
namespace: namepsace we're running
client: controller client
kabaneroIntegration: true to generate kabanero integration attributes when processing appsody config builds
remoteAddr: remote address of incoming request. Currently not used as in OCP it is an internal IP:port that changes

func (*Processor) StartListeners

func (p *Processor) StartListeners() error

StartListeners starts all event source listeners.

type SendEventHandler

type SendEventHandler func(processor *Processor, dest string, buf []byte, header map[string][]string) error

Jump to

Keyboard shortcuts

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