Documentation ¶
Index ¶
- type Dispatcher
- type Router
- func (r *Router) AddBindings(b config.BotBindings) *Router
- func (r *Router) AddBindingsByIDIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByID]) *Router
- func (r *Router) AddBindingsByNameIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByName]) *Router
- func (r *Router) AddBindingsIfConditionTrue(condition bool, b config.BotBindings) *Router
- func (r *Router) AddCommunicationsBindings(c config.Communications)
- func (r *Router) AddElsIndexSinkBindingsIfConditionTrue(condition bool, b map[string]config.ELSIndex) *Router
- func (r *Router) AddEnabledActionBindings(c config.Actions)
- func (r *Router) AddSinkBindingsIfConditionTrue(condition bool, b config.SinkBindings) *Router
- func (r *Router) BuildTable(cfg *config.Config) *Router
- func (r *Router) GetBoundSources(sources map[string]config.Sources) map[string]config.Sources
- func (r *Router) HandleMappedEvent(ctx context.Context, targetEvent config.EventType, handlerFn eventHandler)
- func (r *Router) MapWithEventsInformer(srcEvent config.EventType, dstEvent config.EventType, ...) error
- func (r *Router) RegisterEventHandler(ctx context.Context, eventType config.EventType, handlerFn eventHandler)
- func (r *Router) RegisterInformers(targetEvents []config.EventType, handler registrationHandler) error
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher provides functionality to starts a given plugin, watches for incoming events and calling all notifiers to dispatch received event.
func NewDispatcher ¶
func NewDispatcher(log logrus.FieldLogger, notifiers []notifier.Notifier, manager *plugin.Manager) *Dispatcher
NewDispatcher create a new Dispatcher instance.
func (*Dispatcher) Dispatch ¶
func (d *Dispatcher) Dispatch(ctx context.Context, pluginName string, pluginConfigs []*source.Config, sources []string) error
Dispatch starts a given plugin, watches for incoming events and calling all notifiers to dispatch received event. Once we will have the gRPC contract established with proper Cloud Event schema, we should move also this logic here: https://github.com/kubeshop/botkube/blob/525c737956ff820a09321879284037da8bf5d647/pkg/controller/controller.go#L200-L253
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router routes handled event types from registered informers to configured sources
func NewRouter ¶
func NewRouter(mapper meta.RESTMapper, dynamicCli dynamic.Interface, log logrus.FieldLogger) *Router
NewRouter creates a new router to use for routing event types to registered informers.
func (*Router) AddBindings ¶
func (r *Router) AddBindings(b config.BotBindings) *Router
AddBindings adds source binding names to dictate which source bindings the router should use.
func (*Router) AddBindingsByIDIfConditionTrue ¶
func (r *Router) AddBindingsByIDIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByID]) *Router
AddBindingsByIDIfConditionTrue adds source binding names to dictate which source bindings the router should use.
func (*Router) AddBindingsByNameIfConditionTrue ¶
func (r *Router) AddBindingsByNameIfConditionTrue(condition bool, c config.IdentifiableMap[config.ChannelBindingsByName]) *Router
AddBindingsByNameIfConditionTrue adds source binding names to dictate which source bindings the router should use.
func (*Router) AddBindingsIfConditionTrue ¶
func (r *Router) AddBindingsIfConditionTrue(condition bool, b config.BotBindings) *Router
AddBindingsIfConditionTrue adds source binding names to dictate which source bindings the router should use.
func (*Router) AddCommunicationsBindings ¶
func (r *Router) AddCommunicationsBindings(c config.Communications)
AddCommunicationsBindings adds source binding from a given communications
func (*Router) AddElsIndexSinkBindingsIfConditionTrue ¶
func (r *Router) AddElsIndexSinkBindingsIfConditionTrue(condition bool, b map[string]config.ELSIndex) *Router
AddElsIndexSinkBindingsIfConditionTrue adds source bindings names to dictate which source bindings the router should use.
func (*Router) AddEnabledActionBindings ¶
AddEnabledActionBindings adds source bindings for enabled Actions.
func (*Router) AddSinkBindingsIfConditionTrue ¶
func (r *Router) AddSinkBindingsIfConditionTrue(condition bool, b config.SinkBindings) *Router
AddSinkBindingsIfConditionTrue adds source bindings names to dictate which source bindings the router should use.
func (*Router) BuildTable ¶
BuildTable builds the routers routing table marking it ready to register, map and handle informer events.
func (*Router) GetBoundSources ¶
GetBoundSources returns the Sources the router uses based on preconfigured source binding names.
func (*Router) HandleMappedEvent ¶
func (r *Router) HandleMappedEvent(ctx context.Context, targetEvent config.EventType, handlerFn eventHandler)
HandleMappedEvent allows router clients to create handlers that are triggered for a target mapped event.
func (*Router) MapWithEventsInformer ¶
func (r *Router) MapWithEventsInformer(srcEvent config.EventType, dstEvent config.EventType, handler registrationHandler) error
MapWithEventsInformer allows resources to report on an event (srcEvent) that can only be observed by watching the general k8s v1/events resource using a different event (dstEvent).
For example, you can report the "error" EventType for a resource by having the router watch/interrogate the "warning" EventType reported by the v1/events resource.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler analyzes the provided configuration and based on that schedules plugin sources.
func NewScheduler ¶
func NewScheduler(log logrus.FieldLogger, cfg *config.Config, dispatcher pluginDispatcher) *Scheduler
NewScheduler create a new Scheduler instance.