Documentation ¶
Index ¶
- Constants
- Variables
- func CaptureRaspiStill(cameraParams map[string]string) (bytes []byte, err error)
- type CollectedError
- type CollectedErrors
- type DedupArgs
- type EditConfigData
- type EvalArgs
- type FieldWithType
- type FreepsOperator
- type Graph
- type GraphDesc
- type GraphEngine
- func (ge *GraphEngine) AddExternalGraph(graphName string, gd *GraphDesc, fileName string) error
- func (ge *GraphEngine) AddExternalGraphs(graphs map[string]GraphDesc, fileName string) error
- func (ge *GraphEngine) AddTemporaryGraph(graphName string, gd *GraphDesc) error
- func (ge *GraphEngine) CheckGraph(graphName string) *OperatorIO
- func (ge *GraphEngine) DeleteTemporaryGraph(graphName string)
- func (ge *GraphEngine) ExecuteGraph(graphName string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO
- func (ge *GraphEngine) ExecuteOperatorByName(logger log.FieldLogger, opName string, fn string, mainArgs map[string]string, ...) *OperatorIO
- func (ge *GraphEngine) GetAllGraphDesc() map[string]*GraphDesc
- func (ge *GraphEngine) GetGraphDesc(graphName string) (*GraphDesc, bool)
- func (ge *GraphEngine) GetOperator(opName string) FreepsOperator
- func (ge *GraphEngine) GetOperators() []string
- func (ge *GraphEngine) HasOperator(opName string) bool
- func (ge *GraphEngine) ReadConfig() GraphEngineConfig
- func (ge *GraphEngine) ReloadRequested() bool
- type GraphEngineConfig
- type GraphOperationDesc
- type InMemoryStore
- type JsonArgs
- type MessageAndTime
- type OpCurl
- type OpEval
- func (m *OpEval) Eval(vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpEval) EvalFloat(vInterface interface{}, op string, v2Interface interface{}) (bool, error)
- func (m *OpEval) EvalInt(vInterface interface{}, op string, v2Interface interface{}) (bool, error)
- func (m *OpEval) EvalString(vInterface interface{}, op string, v2Interface interface{}) (bool, error)
- func (m *OpEval) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpEval) Flatten(vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpEval) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
- func (m *OpEval) GetFunctions() []string
- func (m *OpEval) GetPossibleArgs(fn string) []string
- func (m *OpEval) Regexp(args map[string]string, input *OperatorIO) *OperatorIO
- type OpFlux
- type OpFritz
- func (m *OpFritz) Execute(mixedCaseFn string, vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpFritz) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
- func (m *OpFritz) GetDeviceByAIN(AIN string) (*freepslib.AvmDevice, error)
- func (m *OpFritz) GetDevices() map[string]string
- func (m *OpFritz) GetFunctions() []string
- func (m *OpFritz) GetPossibleArgs(fn string) []string
- func (m *OpFritz) GetTemplates() map[string]string
- type OpGraph
- type OpMQTT
- type OpMutt
- type OpRaspistill
- func (m *OpRaspistill) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpRaspistill) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
- func (m *OpRaspistill) GetFunctions() []string
- func (m *OpRaspistill) GetPossibleArgs(fn string) []string
- type OpStore
- type OpSystem
- type OpTelegram
- func (m *OpTelegram) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
- func (m *OpTelegram) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
- func (m *OpTelegram) GetFunctions() []string
- func (m *OpTelegram) GetPossibleArgs(fn string) []string
- type OpTemplate
- func (o *OpTemplate) Execute(fn string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO
- func (o *OpTemplate) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
- func (o *OpTemplate) GetFunctions() []string
- func (o *OpTemplate) GetPossibleArgs(fn string) []string
- type OpTime
- type OpUI
- type OperatorIO
- func MakeByteOutput(output []byte) *OperatorIO
- func MakeByteOutputWithContentType(output []byte, contentType string) *OperatorIO
- func MakeEmptyOutput() *OperatorIO
- func MakeObjectOutput(output interface{}) *OperatorIO
- func MakeOutputError(code uint32, msg string, a ...interface{}) *OperatorIO
- func MakePlainOutput(msg string, a ...interface{}) *OperatorIO
- func (io *OperatorIO) GetArgsMap() (map[string]string, error)
- func (io *OperatorIO) GetBytes() ([]byte, error)
- func (io *OperatorIO) GetError() error
- func (io *OperatorIO) GetString() string
- func (io *OperatorIO) IsEmpty() bool
- func (io *OperatorIO) IsError() bool
- func (io *OperatorIO) IsPlain() bool
- func (oio *OperatorIO) Log(logger logrus.FieldLogger)
- func (io *OperatorIO) ParseFormData() (url.Values, error)
- func (io *OperatorIO) ParseJSON(obj interface{}) error
- func (oio *OperatorIO) ToString() string
- func (oio *OperatorIO) WriteTo(bwriter io.Writer) (int, error)
- type OutputT
- type ShowGraphsData
- type StoreNamespace
- type SunriseOutput
- type TelegramConfig
- type TemplateData
Constants ¶
const ROOT_SYMBOL = "_"
Variables ¶
var DefaultGraphEngineConfig = GraphEngineConfig{GraphsFromFile: []string{}, GraphsFromURL: []string{}, Graphs: map[string]GraphDesc{}}
var DefaultTelegramConfig = TelegramConfig{Token: ""}
Functions ¶
Types ¶
type CollectedError ¶
type CollectedError struct { Input *OperatorIO Error string Time time.Time GraphName string Operation *GraphOperationDesc }
CollectedError store an error, the timestamp and the name of the graph and operation
type CollectedErrors ¶
type CollectedErrors struct {
// contains filtered or unexported fields
}
CollectedErrors is a top-k-list of CollectedError
func NewCollectedErrors ¶
func NewCollectedErrors(maxLen int) *CollectedErrors
NewCollectedErrors creates a new CollectedErrors
func (*CollectedErrors) AddError ¶
func (ce *CollectedErrors) AddError(input *OperatorIO, err *OperatorIO, graphName string, od *GraphOperationDesc)
AddError adds an error to the CollectedErrors
func (*CollectedErrors) GetErrorsForGraph ¶
func (ce *CollectedErrors) GetErrorsForGraph(since time.Time, graphName string) []*CollectedError
GetErrorsForGraph returns the error that occured in the given duration for a gien graph
func (*CollectedErrors) GetErrorsSince ¶
func (ce *CollectedErrors) GetErrorsSince(d time.Duration) []*CollectedError
GetErrorsSince returns the error that occured in the given duration
type EditConfigData ¶
type FieldWithType ¶
type FreepsOperator ¶
type FreepsOperator interface { // GetOutputType() OutputT Execute(fn string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO GetFunctions() []string // returns a list of functions that this operator can execute GetPossibleArgs(fn string) []string GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string }
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is the instance created from a GraphDesc and contains the runtime data
type GraphDesc ¶
type GraphDesc struct { Tags []string Source string OutputFrom string Operations []GraphOperationDesc }
GraphDesc contains a number of operations and defines which output to use
type GraphEngine ¶
type GraphEngine struct {
// contains filtered or unexported fields
}
GraphEngine holds all available graphs and operators
func NewGraphEngine ¶
func NewGraphEngine(cr *utils.ConfigReader, cancel context.CancelFunc) *GraphEngine
NewGraphEngine creates the graph engine from the config
func (*GraphEngine) AddExternalGraph ¶
func (ge *GraphEngine) AddExternalGraph(graphName string, gd *GraphDesc, fileName string) error
AddExternalGraph adds a graph to the external graph list and stores it in the config directory
func (*GraphEngine) AddExternalGraphs ¶
func (ge *GraphEngine) AddExternalGraphs(graphs map[string]GraphDesc, fileName string) error
AddExternalGraphs adds a graph to the external graph list and stores it in the config directory
func (*GraphEngine) AddTemporaryGraph ¶
func (ge *GraphEngine) AddTemporaryGraph(graphName string, gd *GraphDesc) error
AddTemporaryGraph adds a graph to the temporary graph list
func (*GraphEngine) CheckGraph ¶
func (ge *GraphEngine) CheckGraph(graphName string) *OperatorIO
CheckGraph checks if the graph is valid
func (*GraphEngine) DeleteTemporaryGraph ¶
func (ge *GraphEngine) DeleteTemporaryGraph(graphName string)
DeleteTemporaryGraph deletes the graph from the temporary graph list
func (*GraphEngine) ExecuteGraph ¶
func (ge *GraphEngine) ExecuteGraph(graphName string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO
ExecuteGraph executes a graph stored in the engine
func (*GraphEngine) ExecuteOperatorByName ¶
func (ge *GraphEngine) ExecuteOperatorByName(logger log.FieldLogger, opName string, fn string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO
ExecuteOperatorByName executes an operator directly
func (*GraphEngine) GetAllGraphDesc ¶
func (ge *GraphEngine) GetAllGraphDesc() map[string]*GraphDesc
GetAllGraphDesc returns all graphs by name
func (*GraphEngine) GetGraphDesc ¶
func (ge *GraphEngine) GetGraphDesc(graphName string) (*GraphDesc, bool)
GetGraphDesc returns the graph description stored under graphName
func (*GraphEngine) GetOperator ¶
func (ge *GraphEngine) GetOperator(opName string) FreepsOperator
GetOperator returns the operator with the given name
func (*GraphEngine) GetOperators ¶
func (ge *GraphEngine) GetOperators() []string
GetOperators returns the list of available operators
func (*GraphEngine) HasOperator ¶
func (ge *GraphEngine) HasOperator(opName string) bool
HasOperator returns true if this operator is available in the engine
func (*GraphEngine) ReadConfig ¶
func (ge *GraphEngine) ReadConfig() GraphEngineConfig
ReadConfig reads the config from the config reader
func (*GraphEngine) ReloadRequested ¶
func (ge *GraphEngine) ReloadRequested() bool
ReloadRequested returns true if a reload was requested instead of a restart
type GraphEngineConfig ¶
type GraphEngineConfig struct { Graphs map[string]GraphDesc GraphsFromURL []string GraphsFromFile []string }
GraphEngineConfig is the configuration for the GraphEngine
type GraphOperationDesc ¶
type GraphOperationDesc struct { Name string `json:",omitempty"` Operator string Function string Arguments map[string]string `json:",omitempty"` InputFrom string `json:",omitempty"` ExecuteOnFailOf string `json:",omitempty"` ArgumentsFrom string `json:",omitempty"` IgnoreMainArgs bool `json:",omitempty"` }
GraphOperationDesc defines which operator to execute with Arguments and where to take the input from
func (*GraphOperationDesc) ToQuicklink ¶
func (gop *GraphOperationDesc) ToQuicklink() string
ToQuicklink returns the URL to call a standalone-operation outside of a Graph
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
func (*InMemoryStore) GetNamespace ¶
func (s *InMemoryStore) GetNamespace(ns string) *StoreNamespace
GetNamespace from the store, create if it does not exist
func (*InMemoryStore) GetNamespaces ¶
func (s *InMemoryStore) GetNamespaces() []string
GetNamespaces returns all namespaces
type MessageAndTime ¶
type MessageAndTime struct {
// contains filtered or unexported fields
}
type OpCurl ¶
type OpCurl struct { }
func (*OpCurl) Execute ¶
func (o *OpCurl) Execute(function string, vars map[string]string, mainInput *OperatorIO) *OperatorIO
func (*OpCurl) GetArgSuggestions ¶
func (*OpCurl) GetFunctions ¶
func (*OpCurl) GetPossibleArgs ¶
type OpEval ¶
type OpEval struct {
// contains filtered or unexported fields
}
func (*OpEval) Eval ¶
func (m *OpEval) Eval(vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpEval) EvalString ¶
func (*OpEval) Execute ¶
func (m *OpEval) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpEval) Flatten ¶
func (m *OpEval) Flatten(vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpEval) GetArgSuggestions ¶
func (*OpEval) GetFunctions ¶
func (*OpEval) GetPossibleArgs ¶
func (*OpEval) Regexp ¶
func (m *OpEval) Regexp(args map[string]string, input *OperatorIO) *OperatorIO
type OpFlux ¶
type OpFlux struct {
// contains filtered or unexported fields
}
func NewFluxMod ¶
func NewFluxMod(cr *utils.ConfigReader) *OpFlux
func (*OpFlux) Execute ¶
func (o *OpFlux) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpFlux) GetArgSuggestions ¶
func (*OpFlux) GetFunctions ¶
func (*OpFlux) GetPossibleArgs ¶
type OpFritz ¶
type OpFritz struct {
// contains filtered or unexported fields
}
func NewOpFritz ¶
func NewOpFritz(cr *utils.ConfigReader) *OpFritz
NewOpFritz creates a new operator for Freeps and Freepsflux
func (*OpFritz) Execute ¶
func (m *OpFritz) Execute(mixedCaseFn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpFritz) GetArgSuggestions ¶
func (*OpFritz) GetDeviceByAIN ¶
GetDeviceByAIN returns the device object for the device with the given AIN
func (*OpFritz) GetDevices ¶
GetDevices returns a map of all devices
func (*OpFritz) GetFunctions ¶
func (*OpFritz) GetPossibleArgs ¶
func (*OpFritz) GetTemplates ¶
GetTemplates returns a map of all templates
type OpGraph ¶
type OpGraph struct {
// contains filtered or unexported fields
}
func (*OpGraph) Execute ¶
func (o *OpGraph) Execute(fn string, args map[string]string, input *OperatorIO) *OperatorIO
func (*OpGraph) GetArgSuggestions ¶
func (*OpGraph) GetFunctions ¶
GetFunctions returns a list of graphs stored in the engine
func (*OpGraph) GetPossibleArgs ¶
type OpMQTT ¶
type OpMQTT struct { }
func NewMQTTOp ¶
func NewMQTTOp(cr *utils.ConfigReader) *OpMQTT
func (*OpMQTT) Execute ¶
func (o *OpMQTT) Execute(fn string, args map[string]string, input *OperatorIO) *OperatorIO
func (*OpMQTT) GetArgSuggestions ¶
func (*OpMQTT) GetFunctions ¶
func (*OpMQTT) GetPossibleArgs ¶
type OpMutt ¶
type OpMutt struct{}
func (*OpMutt) Execute ¶
func (o *OpMutt) Execute(fn string, args map[string]string, input *OperatorIO) *OperatorIO
func (*OpMutt) GetArgSuggestions ¶
func (*OpMutt) GetFunctions ¶
GetFunctions returns a list of graphs stored in the engine
func (*OpMutt) GetPossibleArgs ¶
type OpRaspistill ¶
type OpRaspistill struct { }
func (*OpRaspistill) Execute ¶
func (m *OpRaspistill) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpRaspistill) GetArgSuggestions ¶
func (*OpRaspistill) GetFunctions ¶
func (m *OpRaspistill) GetFunctions() []string
func (*OpRaspistill) GetPossibleArgs ¶
func (m *OpRaspistill) GetPossibleArgs(fn string) []string
type OpStore ¶
type OpStore struct {
// contains filtered or unexported fields
}
func (*OpStore) Execute ¶
func (o *OpStore) Execute(fn string, args map[string]string, input *OperatorIO) *OperatorIO
Execute gets, sets or deletes a value from the store
func (*OpStore) GetArgSuggestions ¶
func (o *OpStore) GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string
GetArgSuggestions returns suggestions for arguments
func (*OpStore) GetFunctions ¶
GetFunctions returns the functions of this operator
func (*OpStore) GetPossibleArgs ¶
GetPossibleArgs returns the possible arguments for a function
type OpSystem ¶
type OpSystem struct {
// contains filtered or unexported fields
}
func NewSytemOp ¶
func NewSytemOp(ge *GraphEngine, cancel context.CancelFunc) *OpSystem
func (*OpSystem) Execute ¶
func (o *OpSystem) Execute(fn string, args map[string]string, input *OperatorIO) *OperatorIO
func (*OpSystem) GetArgSuggestions ¶
func (*OpSystem) GetFunctions ¶
func (*OpSystem) GetPossibleArgs ¶
type OpTelegram ¶
type OpTelegram struct {
// contains filtered or unexported fields
}
func NewTelegramBot ¶
func NewTelegramBot(cr *utils.ConfigReader) *OpTelegram
func (*OpTelegram) Execute ¶
func (m *OpTelegram) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpTelegram) GetArgSuggestions ¶
func (*OpTelegram) GetFunctions ¶
func (m *OpTelegram) GetFunctions() []string
func (*OpTelegram) GetPossibleArgs ¶
func (m *OpTelegram) GetPossibleArgs(fn string) []string
type OpTemplate ¶
type OpTemplate struct {
// contains filtered or unexported fields
}
func NewTemplateOperator ¶
func NewTemplateOperator(ge *GraphEngine, cr *utils.ConfigReader) *OpTemplate
func (*OpTemplate) Execute ¶
func (o *OpTemplate) Execute(fn string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO
func (*OpTemplate) GetArgSuggestions ¶
func (*OpTemplate) GetFunctions ¶
func (o *OpTemplate) GetFunctions() []string
func (*OpTemplate) GetPossibleArgs ¶
func (o *OpTemplate) GetPossibleArgs(fn string) []string
type OpTime ¶
type OpTime struct { }
func (*OpTime) Execute ¶
func (o *OpTime) Execute(function string, vars map[string]string, mainInput *OperatorIO) *OperatorIO
func (*OpTime) GetArgSuggestions ¶
func (*OpTime) GetFunctions ¶
func (*OpTime) GetPossibleArgs ¶
type OpUI ¶
type OpUI struct {
// contains filtered or unexported fields
}
func NewHTMLUI ¶
func NewHTMLUI(cr *utils.ConfigReader, graphEngine *GraphEngine) *OpUI
NewHTMLUI creates a UI interface based on the inline template above
func (*OpUI) Execute ¶
func (o *OpUI) Execute(fn string, vars map[string]string, input *OperatorIO) *OperatorIO
func (*OpUI) GetArgSuggestions ¶
func (*OpUI) GetFunctions ¶
func (*OpUI) GetPossibleArgs ¶
type OperatorIO ¶
OperatorIO is the input and output of an operator, once created it should not be modified Note: the Store Operator depends on this struct being immutable
func MakeByteOutput ¶
func MakeByteOutput(output []byte) *OperatorIO
func MakeByteOutputWithContentType ¶
func MakeByteOutputWithContentType(output []byte, contentType string) *OperatorIO
func MakeEmptyOutput ¶
func MakeEmptyOutput() *OperatorIO
func MakeObjectOutput ¶
func MakeObjectOutput(output interface{}) *OperatorIO
func MakeOutputError ¶
func MakeOutputError(code uint32, msg string, a ...interface{}) *OperatorIO
func MakePlainOutput ¶
func MakePlainOutput(msg string, a ...interface{}) *OperatorIO
func (*OperatorIO) GetArgsMap ¶
func (io *OperatorIO) GetArgsMap() (map[string]string, error)
func (*OperatorIO) GetBytes ¶
func (io *OperatorIO) GetBytes() ([]byte, error)
func (*OperatorIO) GetError ¶
func (io *OperatorIO) GetError() error
func (*OperatorIO) GetString ¶
func (io *OperatorIO) GetString() string
func (*OperatorIO) IsEmpty ¶
func (io *OperatorIO) IsEmpty() bool
func (*OperatorIO) IsError ¶
func (io *OperatorIO) IsError() bool
func (*OperatorIO) IsPlain ¶
func (io *OperatorIO) IsPlain() bool
func (*OperatorIO) Log ¶
func (oio *OperatorIO) Log(logger logrus.FieldLogger)
func (*OperatorIO) ParseFormData ¶
func (io *OperatorIO) ParseFormData() (url.Values, error)
ParseFormData returns the data as posted by a HTML form
func (*OperatorIO) ParseJSON ¶
func (io *OperatorIO) ParseJSON(obj interface{}) error
func (*OperatorIO) ToString ¶
func (oio *OperatorIO) ToString() string
type ShowGraphsData ¶
type StoreNamespace ¶
type StoreNamespace struct {
// contains filtered or unexported fields
}
func (*StoreNamespace) DeleteValue ¶
func (s *StoreNamespace) DeleteValue(key string)
DeleteValue from the StoreNamespace
func (*StoreNamespace) GetAllValues ¶
func (s *StoreNamespace) GetAllValues() map[string]*OperatorIO
GetAllValues from the StoreNamespace
func (*StoreNamespace) GetKeys ¶
func (s *StoreNamespace) GetKeys() []string
GetKeys returns all keys in the StoreNamespace
func (*StoreNamespace) GetValue ¶
func (s *StoreNamespace) GetValue(key string) *OperatorIO
GetValue from the StoreNamespace
func (*StoreNamespace) SetValue ¶
func (s *StoreNamespace) SetValue(key string, io *OperatorIO)
SetValue in the StoreNamespace