template

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBodyToParams

func ApplyBodyToParams(body []byte, params []pipelinev1.Param) ([]pipelinev1.Param, error)

ApplyBodyToParams returns the params with each body path variable replaced with the appropriate data from the body. Returns an error when the body path variable is not found in the body.

func ApplyHeaderToParams

func ApplyHeaderToParams(header map[string][]string, params []pipelinev1.Param) ([]pipelinev1.Param, error)

ApplyHeaderToParams returns the params with each header variable replaced with the appropriate header value. Returns an error when the header variable is not found.

func ApplyParamsToResourceTemplate

func ApplyParamsToResourceTemplate(params []pipelinev1.Param, rt json.RawMessage) json.RawMessage

ApplyParamsToResourceTemplate returns the TriggerResourceTemplate with the param values substituted for all matching param variables in the template

func ApplyUIDToResourceTemplate

func ApplyUIDToResourceTemplate(rt json.RawMessage, uid string) json.RawMessage

ApplyUIDToResourceTemplate returns the TriggerResourceTemplate after uid replacement The same uid should be used per trigger to properly address resources throughout the TriggerTemplate.

func MergeInDefaultParams

func MergeInDefaultParams(params []pipelinev1.Param, paramSpecs []pipelinev1.ParamSpec) []pipelinev1.Param

MergeInDefaultParams returns the params with the addition of all paramSpecs that have default values and are already in the params list

func MergeParams

func MergeParams(params1 []pipelinev1.Param, params2 []pipelinev1.Param) ([]pipelinev1.Param, error)

MergeParams merges two param arrays. An error is returned if there are multiple params with the same name.

func NewResources

func NewResources(body []byte, header map[string][]string, elParams []pipelinev1.Param, binding ResolvedBinding) ([]json.RawMessage, error)

NewResources returns all resources defined when applying the event and elParams to the TriggerTemplate and TriggerBinding in the ResolvedBinding.

func UID

func UID() string

UID generates a random string like the Kubernetes apiserver generateName metafield postfix.

Types

type ResolvedBinding

type ResolvedBinding struct {
	TriggerBinding  *triggersv1.TriggerBinding
	TriggerTemplate *triggersv1.TriggerTemplate
}

ResolvedBinding contains the dereferenced TriggerBinding and TriggerTemplate after resolving the k8s ObjectRef.

func ResolveBinding

func ResolveBinding(trigger triggersv1.EventListenerTrigger, getTB getTriggerBinding, getTT getTriggerTemplate) (ResolvedBinding, error)

ResolveBinding takes in a trigger containing object refs to bindings and templates and resolves them to their underlying values.

Jump to

Keyboard shortcuts

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