Documentation ¶
Index ¶
- func Factories() map[string]Factory
- func GetLogger(ref string) log.Logger
- func LegacyRegister(ref string, f Factory) error
- func NewHandlerContext(parentCtx context.Context, config *HandlerConfig) context.Context
- func Register(trigger Trigger, f Factory) error
- type ActionConfig
- type Config
- type Descriptor
- type Factory
- type Handler
- type HandlerConfig
- type HandlerInfo
- type InitContext
- type Metadata
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandlerContext ¶
func NewHandlerContext(parentCtx context.Context, config *HandlerConfig) context.Context
NewHandlerContext add the handler info to a new child context
Types ¶
type ActionConfig ¶
type ActionConfig struct { *action.Config If string `json:"if,omitempty"` Input map[string]interface{} `json:"input,omitempty"` Output map[string]interface{} `json:"output,omitempty"` Act action.Action `json:"-,omitempty"` }
ActionConfig is the configuration for the Action
type Config ¶
type Config struct { Id string `json:"id"` Ref string `json:"ref"` Settings map[string]interface{} `json:"settings"` Handlers []*HandlerConfig `json:"handlers"` //DEPRECATED Type string `json:"type,omitempty"` }
Config is the configuration for a Trigger
type Descriptor ¶
type Factory ¶
type Factory interface { // Metadata returns the metadata of the trigger Metadata() *Metadata // New create a new Trigger New(config *Config) (Trigger, error) }
Factory is used to create new instances of a trigger
func GetFactory ¶
type Handler ¶
type Handler interface { Name() string Settings() map[string]interface{} Handle(ctx context.Context, triggerData interface{}) (map[string]interface{}, error) }
func NewHandler ¶
type HandlerConfig ¶
type HandlerConfig struct { Name string `json:"name,omitempty"` Settings map[string]interface{} `json:"settings"` Actions []*ActionConfig `json:"actions"` OutputSchemas map[string]interface{} `json:"outputSchemas,omitempty"` // contains filtered or unexported fields }
func (*HandlerConfig) UnmarshalJSON ¶
func (hc *HandlerConfig) UnmarshalJSON(d []byte) error
UnmarshalJSON overrides the default UnmarshalJSON for TaskInst
type HandlerInfo ¶
type HandlerInfo struct {
Name string
}
func HandlerFromContext ¶
func HandlerFromContext(ctx context.Context) (*HandlerInfo, bool)
HandlerFromContext returns the handler info stored in the context, if any.
type InitContext ¶
type InitContext interface { // Logger the logger for the trigger Logger() log.Logger // GetHandlers gets the handlers associated with the trigger GetHandlers() []Handler }
InitContext is the initialization context for the trigger instance
type Metadata ¶
type Metadata struct { Settings map[string]data.TypedValue HandlerSettings map[string]data.TypedValue Output map[string]data.TypedValue Reply map[string]data.TypedValue //DEPRECATED ID string }
func NewMetadata ¶
func NewMetadata(mdStructs ...interface{}) *Metadata
Click to show internal directories.
Click to hide internal directories.