beehive: github.com/muesli/beehive/bees Index | Files | Directories

package bees

import "github.com/muesli/beehive/bees"

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Package bees is Beehive's central module system.

Index

Package Files

actions.go bees.go chains.go config.go context.go descriptors.go events.go factories.go filters.go logs.go options.go placeholders.go

func ConvertValue Uses

func ConvertValue(v interface{}, dst interface{}) error

ConvertValue tries to convert v to dst.

func DeleteBee Uses

func DeleteBee(bee *BeeInterface)

DeleteBee removes a Bee instance.

func Log Uses

func Log(bee string, message string, messageType MessageType)

Log adds a new LogMessage to the log

func RegisterBee Uses

func RegisterBee(bee BeeInterface)

RegisterBee gets called by Bees to register themselves.

func RegisterFactory Uses

func RegisterFactory(factory BeeFactoryInterface)

RegisterFactory gets called by BeeFactories to register themselves.

func RestartBee Uses

func RestartBee(bee *BeeInterface)

RestartBee restarts a Bee.

func RestartBees Uses

func RestartBees(bees []BeeConfig)

RestartBees stops all running bees and restarts a new set of bees.

func SetActions Uses

func SetActions(as []Action)

SetActions sets the currently configured actions.

func SetChains Uses

func SetChains(cs []Chain)

SetChains sets the currently configured chains

func StartBees Uses

func StartBees(beeList []BeeConfig)

StartBees starts all registered bees.

func StopBees Uses

func StopBees()

StopBees stops all bees gracefully.

func UUID Uses

func UUID() string

UUID generates a new unique ID.

type Action Uses

type Action struct {
    ID      string
    Bee     string
    Name    string
    Options Placeholders
}

Action describes an action.

func GetAction Uses

func GetAction(id string) *Action

GetAction returns one action with a specific ID.

func GetActions Uses

func GetActions() []Action

GetActions returns all configured actions.

type ActionDescriptor Uses

type ActionDescriptor struct {
    Namespace   string
    Name        string
    Description string
    Options     []PlaceholderDescriptor
}

ActionDescriptor describes an Action provided by a Bee.

func GetActionDescriptor Uses

func GetActionDescriptor(action *Action) ActionDescriptor

GetActionDescriptor returns the ActionDescriptor matching an action.

type Bee Uses

type Bee struct {
    Running bool
    SigChan chan bool
    // contains filtered or unexported fields
}

Bee is the base-struct to be embedded by bee implementations.

func NewBee Uses

func NewBee(name, factoryName, description string, options []BeeOption) Bee

NewBee returns a new bee and sets up sig-channel & waitGroup.

func (*Bee) Action Uses

func (bee *Bee) Action(action Action) []Placeholder

Action is the default, empty implementation of a Bee's Action method.

func (*Bee) Config Uses

func (bee *Bee) Config() BeeConfig

Config returns the config for a bee.

func (*Bee) ContextSet Uses

func (bee *Bee) ContextSet(key string, value interface{})

func (*Bee) ContextValue Uses

func (bee *Bee) ContextValue(key string) interface{}

func (*Bee) Description Uses

func (bee *Bee) Description() string

Description returns the description for a bee.

func (*Bee) IsRunning Uses

func (bee *Bee) IsRunning() bool

IsRunning returns whether a Bee is currently running.

func (*Bee) LastAction Uses

func (bee *Bee) LastAction() time.Time

LastAction returns the timestamp of the last triggered action.

func (*Bee) LastEvent Uses

func (bee *Bee) LastEvent() time.Time

LastEvent returns the timestamp of the last triggered event.

func (*Bee) LogAction Uses

func (bee *Bee) LogAction()

LogAction logs the last triggered action.

func (*Bee) LogDebugf Uses

func (bee *Bee) LogDebugf(format string, args ...interface{})

LogDebugf logs a formatted debug string

func (*Bee) LogErrorf Uses

func (bee *Bee) LogErrorf(format string, args ...interface{})

LogErrorf logs a formatted error string

func (*Bee) LogEvent Uses

func (bee *Bee) LogEvent()

LogEvent logs the last triggered event.

func (*Bee) LogFatal Uses

func (bee *Bee) LogFatal(args ...interface{})

LogFatal logs a fatal error

func (*Bee) Logf Uses

func (bee *Bee) Logf(format string, args ...interface{})

Logf logs a formatted string

func (*Bee) Logln Uses

func (bee *Bee) Logln(args ...interface{})

Logln logs args

func (*Bee) Name Uses

func (bee *Bee) Name() string

Name returns the configured name for a bee.

func (*Bee) Namespace Uses

func (bee *Bee) Namespace() string

Namespace returns the namespace for a bee.

func (*Bee) Options Uses

func (bee *Bee) Options() BeeOptions

Options returns the options for a bee.

func (*Bee) Run Uses

func (bee *Bee) Run(chan Event)

Run is the default, empty implementation of a Bee's Run method.

func (*Bee) SetDescription Uses

func (bee *Bee) SetDescription(s string)

SetDescription sets the description for a bee.

func (*Bee) SetOption Uses

func (bee *Bee) SetOption(name string, value string) bool

SetOption sets one option for a bee.

func (*Bee) SetOptions Uses

func (bee *Bee) SetOptions(options BeeOptions)

SetOptions sets the options for a bee.

func (*Bee) SetSigChan Uses

func (bee *Bee) SetSigChan(c chan bool)

SetSigChan sets the signaling channel for a bee.

func (*Bee) Start Uses

func (bee *Bee) Start()

Start gets called when a Bee gets started.

func (*Bee) Stop Uses

func (bee *Bee) Stop()

Stop gracefully stops a Bee.

func (*Bee) WaitGroup Uses

func (bee *Bee) WaitGroup() *sync.WaitGroup

WaitGroup returns the WaitGroup for a bee.

type BeeConfig Uses

type BeeConfig struct {
    Name        string
    Class       string
    Description string
    Options     BeeOptions
}

BeeConfig contains all settings for a single Bee.

func BeeConfigs Uses

func BeeConfigs() []BeeConfig

BeeConfigs returns configs for all Bees.

func NewBeeConfig Uses

func NewBeeConfig(name, class, description string, options BeeOptions) (BeeConfig, error)

NewBeeConfig validates a configuration and sets up a new BeeConfig

type BeeFactory Uses

type BeeFactory struct {
}

A BeeFactory is the base struct to be embedded by other BeeFactories.

func (*BeeFactory) Actions Uses

func (factory *BeeFactory) Actions() []ActionDescriptor

Actions returns the default empty actions set.

func (*BeeFactory) Events Uses

func (factory *BeeFactory) Events() []EventDescriptor

Events returns the default empty events set.

func (*BeeFactory) Image Uses

func (factory *BeeFactory) Image() string

Image returns an empty image filename per default.

func (*BeeFactory) LogoColor Uses

func (factory *BeeFactory) LogoColor() string

LogoColor returns the default logo color.

func (*BeeFactory) OAuth2AccessToken Uses

func (factory *BeeFactory) OAuth2AccessToken(id, secret, code string) (*oauth2.Token, error)

OAuth2AccessToken returns the oauth2 access token.

func (*BeeFactory) Options Uses

func (factory *BeeFactory) Options() []BeeOptionDescriptor

Options returns the default empty options set.

func (*BeeFactory) States Uses

func (factory *BeeFactory) States() []StateDescriptor

States returns the default empty states set.

type BeeFactoryInterface Uses

type BeeFactoryInterface interface {
    // ID of the module
    ID() string
    // Name of the module
    Name() string
    // Description of the module
    Description() string
    // An image url for the module
    Image() string
    // A logo color for the module
    LogoColor() string

    // OAuth2AccessToken returns the oauth2 access token.
    OAuth2AccessToken(id, secret, code string) (*oauth2.Token, error)

    // Options supported by module
    Options() []BeeOptionDescriptor
    // States provided by module
    States() []StateDescriptor
    // Events defined by module
    Events() []EventDescriptor
    // Actions supported by module
    Actions() []ActionDescriptor

    New(name, description string, options BeeOptions) BeeInterface
}

A BeeFactoryInterface is the interface that gets implemented by a BeeFactory.

func GetFactories Uses

func GetFactories() []*BeeFactoryInterface

GetFactories returns all known bee factories.

func GetFactory Uses

func GetFactory(identifier string) *BeeFactoryInterface

GetFactory returns the factory with a specific name.

type BeeInterface Uses

type BeeInterface interface {
    // Name of the bee
    Name() string
    // Namespace of the bee
    Namespace() string

    // Description of the bee
    Description() string
    // SetDescription sets a description
    SetDescription(s string)

    // Config returns this bees config
    Config() BeeConfig
    // Options of the bee
    Options() BeeOptions
    // SetOptions to configure the bee
    SetOptions(options BeeOptions)

    // ReloadOptions gets called after a bee's options get updated
    ReloadOptions(options BeeOptions)

    // Activates the bee
    Run(eventChannel chan Event)
    // Running returns the current state of the bee
    IsRunning() bool
    // Start the bee
    Start()
    // Stop the bee
    Stop()

    LastEvent() time.Time
    LogEvent()
    LastAction() time.Time
    LogAction()

    Logln(args ...interface{})
    Logf(format string, args ...interface{})
    LogErrorf(format string, args ...interface{})
    LogFatal(args ...interface{})

    SetSigChan(c chan bool)
    WaitGroup() *sync.WaitGroup

    // Handles an action
    Action(action Action) []Placeholder
}

BeeInterface is an interface all bees implement.

func GetBee Uses

func GetBee(identifier string) *BeeInterface

GetBee returns a bee with a specific name.

func GetBees Uses

func GetBees() []*BeeInterface

GetBees returns all known bees.

func NewBeeInstance Uses

func NewBeeInstance(bee BeeConfig) *BeeInterface

NewBeeInstance sets up a new Bee with supplied config.

func StartBee Uses

func StartBee(bee BeeConfig) *BeeInterface

StartBee starts a bee.

type BeeOption Uses

type BeeOption struct {
    Name  string
    Value interface{}
}

A BeeOption is used to configure bees.

type BeeOptionDescriptor Uses

type BeeOptionDescriptor struct {
    Name        string
    Description string
    Type        string
    Default     interface{}
    Mandatory   bool
}

A BeeOptionDescriptor shows which config values a module expects.

type BeeOptions Uses

type BeeOptions []BeeOption

BeeOptions is an array of BeeOption.

func (BeeOptions) Bind Uses

func (opts BeeOptions) Bind(name string, dst interface{}) error

Bind a value from a BeeOptions slice.

func (BeeOptions) Value Uses

func (opts BeeOptions) Value(name string) interface{}

Value retrieves a value from a BeeOptions slice.

type Chain Uses

type Chain struct {
    Name        string
    Description string
    Event       *Event
    Filters     []string
    Actions     []string
    Elements    []ChainElement `json:"Elements,omitempty"`
}

Chain is a user defined chain

func GetChain Uses

func GetChain(id string) *Chain

GetChain returns a chain with a specific id

func GetChains Uses

func GetChains() []Chain

GetChains returns all chains

type ChainElement Uses

type ChainElement struct {
    Action Action
    Filter Filter
}

ChainElement is an element in a Chain

type Context Uses

type Context struct {
    // contains filtered or unexported fields
}

func NewContext Uses

func NewContext() *Context

func (*Context) FillMap Uses

func (c *Context) FillMap(m map[string]interface{})

func (*Context) Set Uses

func (c *Context) Set(bee *Bee, key string, value interface{})

func (*Context) Value Uses

func (c *Context) Value(bee *Bee, key string) interface{}

type Event Uses

type Event struct {
    Bee     string
    Name    string
    Options Placeholders
}

An Event describes an event including its parameters.

type EventDescriptor Uses

type EventDescriptor struct {
    Namespace   string
    Name        string
    Description string
    Options     []PlaceholderDescriptor
}

EventDescriptor describes an Event provided by a Bee.

func GetEventDescriptor Uses

func GetEventDescriptor(event *Event) EventDescriptor

GetEventDescriptor returns the EventDescriptor matching an event.

type Filter Uses

type Filter struct {
    ID      string
    Name    string
    Options FilterOption
}

Filter describes a user configured event filter.

type FilterOption Uses

type FilterOption struct {
    Name            string
    Type            string
    Inverse         bool
    CaseInsensitive bool
    Trimmed         bool
    Value           interface{}
}

A FilterOption used by filters.

type LogMessage Uses

type LogMessage struct {
    ID          string
    Bee         string
    Message     string
    MessageType uint
    Timestamp   time.Time
}

LogMessage stores a log message with its timestamp, type and originating Bee

func GetLogs Uses

func GetLogs(bee string) []LogMessage

GetLogs returns all logs for a Bee.

func NewLogMessage Uses

func NewLogMessage(bee string, message string, messageType MessageType) LogMessage

NewLogMessage returns a newly composed LogMessage

type LogSorter Uses

type LogSorter []LogMessage

LogSorter is used for sorting an array of LogMessages by their timestamp

func (LogSorter) Len Uses

func (a LogSorter) Len() int

func (LogSorter) Less Uses

func (a LogSorter) Less(i, j int) bool

func (LogSorter) Swap Uses

func (a LogSorter) Swap(i, j int)

type MessageType Uses

type MessageType uint

MessageType defines the log level of the log entry we're dealing with

const (
    // LogInfo is for info-level log entries
    LogInfo MessageType = iota

    // LogError is for error-level log entries
    LogError MessageType = iota

    // LogFatal is for fatal-level log entries
    LogFatal MessageType = iota

    // LogDebug is for debug-level log entries
    LogDebug MessageType = iota
)

type Placeholder Uses

type Placeholder struct {
    Name  string
    Type  string
    Value interface{}
}

Placeholder used by ins & outs of a bee.

type PlaceholderDescriptor Uses

type PlaceholderDescriptor struct {
    Name        string
    Description string
    Type        string
    Mandatory   bool
}

A PlaceholderDescriptor shows which in & out values a module expects and returns.

type Placeholders Uses

type Placeholders []Placeholder

Placeholders is an array of Placeholder.

func (Placeholders) Bind Uses

func (ph Placeholders) Bind(name string, dst interface{}) error

Bind a value from a Placeholder slice.

func (*Placeholders) SetValue Uses

func (ph *Placeholders) SetValue(name string, _type string, value interface{})

SetValue sets a value in the Placeholder slice.

func (Placeholders) Value Uses

func (ph Placeholders) Value(name string) interface{}

Value retrieves a value from a Placeholder slice.

type StateDescriptor Uses

type StateDescriptor struct {
    Name        string
    Description string
    Type        string
}

StateDescriptor describes a State provided by a Bee.

Directories

PathSynopsis
alertoverbeePackage alertoverbee is able to send notifications on AlertOver.
anelpowerctrlbeePackage anelpowerctrlbee is a Bee for talking to Anel's PowerCtrl network power sockets.
cfddnsbee
cleverbotbeePackage cleverbotbee is a Bee that can interact with cleverbot
cricketbee
cronbeePackage cronbee is a Bee that acts like a time-based job scheduler (cron).
devrantbeePackage devrantbee is a Bee that can post blogs & quotes on Devrant.
discordbeePackage discordbee is a bee for sending and receiving messages with Discord servers.
efabeePackage efabee is a Bee that interfaces with the public EVA API.
emailbeePackage emailbee is a Bee that is able to send emails.
emailserverbee
execbeePackage execbee is a Bee that can launch external processes.
facebookbeePackage facebookbee is a Bee that can interface with Facebook.
fsnotifybee
githubbeePackage githubbee is a Bee that can interface with GitHub
gitterbeePackage gitterbee is a Bee that can interface with Gitter
gotifybeePackage gotifybee is able to send notifications on Gotify.
hellobeePackage hellobee is an example for a Bee skeleton, designed to help you get started with writing your own Bees.
horizonboxbee
htmlextractbeePackage htmlextractbee is a Bee that can extract metadata from HTTP URLs.
httpbeePackage httpbee is a Bee that lets you trigger HTTP requests.
huebeePackage huebee is a Bee that can talk to Philips Hue bridges.
instapaperbee
ipifybee
ircbeePackage ircbee is a Bee that can connect to an IRC server.
ircbee/irctoolsPackage irctools is a collection of convenient IRC styling methods.
jabberbeePackage jabberbee is a Bee that can connect to a Jabber/XMPP server.
jenkinsbeePackage jenkinsbee is a Bee that can interface with a Jenkins server.
mastodonbee
mixcloudbee
mumblebeePackage mumblebee is a Bee that can connect to a Mumble/XMPP server.
nagiosbeePackage nagiosbee is a Bee that can interface with a Nagios instance.
notificationbeePackage notificationbee is a Bee that can trigger desktop notifications.
openweathermapbeePackage openweathermapbee is a Bee that can interact with cleverbot
pastebinbeePackage pastebinbee is a Bee that can interface with Pastebin.
prometheusbeePackage prometheusbee is a bee designed to expose metrics for scraping by Prometheus.
pushoverbeePackage pushoverbee is a Bee that can send pushover notifications.
redisbee
rocketchatbeePackage rocketchatbee is a Bee that can connect to Rocketchat.
rssbeePackage rssbee is a Bee for handling RSS feeds.
s3bee
serialbeePackage serialbee is a Bee that can send & receive data on a serial port.
simplepushbeePackage simplepushbee is a Bee that is able to send push notifications to Android.
slackbeePackage slackbee is a Bee that can connect to Slack.
socketbeePackage socketbee is a Bee that lets you transmit data via UDP sockets.
spaceapibeePackage spaceapibee is a Bee that can query a spaceapi server.
sunbeePackage sunbee is a bee that sends sunrise/sunset event based on the selected location.
telegrambeePackage telegrambee is a Bee that can connect to Telegram.
timebeePackage timebee is a Bee that can fire events at a specific time.
transmissionbeePackage transmissionbee is a Bee that can send torrents to Transmission.
travisbeePackage travisbee is a bee for monitoring and reacting to the status of TravisCI builds.
tumblrbeePackage tumblrbee is a Bee that can post blogs & quotes on Tumblr.
twiliobeePackage twiliobee is a Bee that is able to send SMS messages.
twitchbeePackage twitchbee is a Bee that can connect to Twitch.
twitterbeePackage twitterbee is a Bee that can interface with Twitter.
webbeePackage webbee is a Bee that starts an HTTP server and fires events for incoming requests.

Package bees imports 17 packages (graph) and is imported by 565 packages. Updated 2021-01-26. Refresh now. Tools for package owners.