 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Factories() map[string]Factory
- func NewContext(parentCtx context.Context, attrs []*data.Attribute) context.Context
- func NewContextWithData(parentCtx context.Context, contextData *ContextData) context.Context
- func NewHandlerContext(parentCtx context.Context, config *HandlerConfig) context.Context
- func NewInitialContext(attrs []*data.Attribute, config *HandlerConfig) context.Context
- func RegisterFactory(ref string, f Factory) error
- type ActionConfig
- type Config
- type ContextData
- type Factory
- type Handler
- func (h *Handler) GetOutput() map[string]interface{}
- func (h *Handler) GetSetting(setting string) (interface{}, bool)
- func (h *Handler) GetStringSetting(setting string) string
- func (h *Handler) Handle(ctx context.Context, triggerData map[string]interface{}) (map[string]*data.Attribute, error)
- func (h *Handler) String() string
 
- type HandlerConfig
- type HandlerInf
- type HandlerInfo
- type HandlerMetadata
- type InitContext
- type InitOlddeprecated
- type Initializable
- type LegacyRunnerdeprecated
- func (*LegacyRunner) Execute(ctx context.Context, act action.Action, inputs map[string]*data.Attribute) (results map[string]*data.Attribute, err error)
- func (lr *LegacyRunner) RegisterHandler(h *Handler)
- func (lr *LegacyRunner) Run(ctx context.Context, act action.Action, uri string, options interface{}) (code int, data interface{}, err error)
- func (lr *LegacyRunner) RunAction(ctx context.Context, act action.Action, options map[string]interface{}) (results map[string]*data.Attribute, err error)
 
- type Metadata
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext returns a new Context that carries the trigger data. DEPRECATED
func NewContextWithData ¶
func NewContextWithData(parentCtx context.Context, contextData *ContextData) context.Context
NewContext returns a new Context that carries the trigger data. DEPRECATED
func NewHandlerContext ¶ added in v0.5.6
func NewHandlerContext(parentCtx context.Context, config *HandlerConfig) context.Context
NewHandlerContext add the handler info to a new child context
func NewInitialContext ¶
func NewInitialContext(attrs []*data.Attribute, config *HandlerConfig) context.Context
DEPRECATED
func RegisterFactory ¶
Types ¶
type ActionConfig ¶ added in v0.5.6
type ActionConfig struct {
	*action.Config
	Mappings *data.IOMappings `json:"mappings"`
	Act action.Action
}
    ActionConfig is the configuration for the Action
type Config ¶
type Config struct {
	Name     string                 `json:"name"`
	Id       string                 `json:"id"`
	Ref      string                 `json:"ref"`
	Settings map[string]interface{} `json:"settings"`
	Output   map[string]interface{} `json:"output"`
	Handlers []*HandlerConfig       `json:"handlers"`
	// Deprecated: Use Output
	Outputs map[string]interface{} `json:"outputs"`
}
    Config is the configuration for a Trigger
func (*Config) GetSetting ¶
type ContextData ¶
type ContextData struct {
	Attrs      []*data.Attribute
	HandlerCfg *HandlerConfig
}
    func ExtractContextData ¶
func ExtractContextData(ctx context.Context) (*ContextData, bool)
DEPRECATED
type Handler ¶
type Handler struct {
	// contains filtered or unexported fields
}
    func NewHandler ¶
func NewHandlerAlt ¶ added in v0.5.7
func NewHandlerAlt(internal HandlerInf) *Handler
func (*Handler) GetSetting ¶
func (*Handler) GetStringSetting ¶
type HandlerConfig ¶
type HandlerConfig struct {
	Name     string                 `json:"name,omitempty"`
	Settings map[string]interface{} `json:"settings"`
	Output   map[string]interface{} `json:"output"`
	Action   *ActionConfig
	// Deprecated: Use Action (*action.Config)
	ActionId string `json:"actionId"`
	// Deprecated: Use Action (*action.Config)
	ActionMappings *data.IOMappings `json:"actionMappings,omitempty"`
	// Deprecated: Use Action (*action.Config)
	ActionOutputMappings []*data.MappingDef `json:"actionOutputMappings,omitempty"`
	// Deprecated: Use Action (*action.Config)
	ActionInputMappings []*data.MappingDef `json:"actionInputMappings,omitempty"`
	// Deprecated: Use Output
	Outputs map[string]interface{} `json:"outputs"`
	// contains filtered or unexported fields
}
    func (*HandlerConfig) GetSetting ¶
func (hc *HandlerConfig) GetSetting(setting string) string
type HandlerInf ¶ added in v0.5.7
type HandlerInfo ¶ added in v0.5.6
type HandlerInfo struct {
	Name string
}
    func HandlerFromContext ¶ added in v0.5.6
func HandlerFromContext(ctx context.Context) (*HandlerInfo, bool)
HandlerFromContext returns the handler info stored in the context, if any.
type HandlerMetadata ¶
EndpointMetadata is the metadata for a Trigger Endpoint
type InitContext ¶
type InitContext interface {
	// GetHandlers gets the handlers associated with the trigger
	GetHandlers() []*Handler
}
    InitContext is the initialization context for the trigger instance
type Initializable ¶
type Initializable interface {
	// Initialize is called to initialize the Trigger
	Initialize(ctx InitContext) error
}
    Initializable interface should be implemented by all Triggers, the Initialize method will eventually move up to Trigger to replace the the old "Init" method
        
          
            type LegacyRunner
            deprecated
            
          
  
    
  
      
      type LegacyRunner struct {
	// contains filtered or unexported fields
}
    Deprecated: Temporarily generated for backwards compatibility support
func NewLegacyRunner ¶
func NewLegacyRunner(runner action.Runner, metadata *Metadata) *LegacyRunner
func (*LegacyRunner) RegisterHandler ¶
func (lr *LegacyRunner) RegisterHandler(h *Handler)
type Metadata ¶
type Metadata struct {
	ID       string
	Version  string
	Handler  *HandlerMetadata
	Settings map[string]*data.Attribute
	Output   map[string]*data.Attribute
	Reply    map[string]*data.Attribute
}
    Metadata is the metadata for a Trigger
func NewMetadata ¶
NewMetadata creates a Metadata object from the json representation todo should return error instead of panic
func (*Metadata) OutputsToAttrs ¶
func (md *Metadata) OutputsToAttrs(outputData map[string]interface{}, coerce bool) ([]*data.Attribute, error)
OutputsToAttrs converts the supplied output data to attributes todo remove coerce option, coercion now happens by default
func (*Metadata) UnmarshalJSON ¶
UnmarshalJSON overrides the default UnmarshalJSON for Metadata