eventsources

package
v0.0.0-...-bcbb5c0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 3 Imported by: 10

Documentation

Overview

Package actions provides types and interfaces necessary to write event sources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEventSourcesList

func GetEventSourcesList() (sources []string)

GetEventSourcesList returns the list of all event sources.

func RegisterEventSource

func RegisterEventSource(name string, ds EventSourceInterface)

RegisterEventSource registers the event source. Must be called from the init() of the event sources.

func SetupEventSources

func SetupEventSources(ch chan EventData, cfp configprovider.ConfigProviderInterface, dslist []string)

SetupEventSources gets the configuration and calls the Setup() function of the event sources in dslist.

Types

type ArgType

type ArgType struct {
	T string `json:"type"`
	N string `json:"name"`
}

ArgType describes the different arguments and their types that an action needs as input. It is only used for humans so you can set arbitrary strings to describe the argument.

type EventData

type EventData struct {
	Name string
	Data map[string]interface{}
}

EventData represents an event. It is sent from a eventsource. Name is the name of the event and Data is an arbitrary map containing the event data.

type EventDesc

type EventDesc struct {
	Args []ArgType `json:"data"`
	Name string    `json:"name"`
}

EventDesc describes an event. Used for the json API.

type EventSourceInterface

type EventSourceInterface interface {
	Setup(ch chan EventData, config []byte) error
	Events() map[string][]ArgType
}

EventSourceInterface is the interface event sources must implement. Setup() is called once when CSF starts and is used to configure and or init modules. Events() returns a map where Keys are events name and values are lists of parameters of the event.

type Events

type Events struct {
	Events []EventDesc `json:"events"`
}

Events is a list of events. Used for the json API.

func GetAllEvents

func GetAllEvents() (events Events)

GetAllEvents returns a list of all events.

Jump to

Keyboard shortcuts

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