Documentation ¶
Index ¶
- func UpsertPlugins(ctx context.Context, channelPluginDir string, logger *logging.Logger, ...)
- func ValidateType(t string) error
- type Channel
- func (c *Channel) IncrementalInitAndValidate() error
- func (c *Channel) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (c *Channel) Notify(contact *recipient.Contact, i contracts.Incident, ev *event.Event, ...) error
- func (c *Channel) Restart()
- func (c *Channel) Start(ctx context.Context, logger *zap.SugaredLogger)
- func (c *Channel) Stop()
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpsertPlugins ¶
func UpsertPlugins(ctx context.Context, channelPluginDir string, logger *logging.Logger, db *database.DB)
UpsertPlugins upsert the available_channel_type table with working plugins
func ValidateType ¶
ValidateType returns an error if non-allowed chars are detected, nil otherwise
Types ¶
type Channel ¶
type Channel struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` Name string `db:"name"` Type string `db:"type"` Config string `db:"config" json:"-"` // excluded from JSON config dump as this may contain sensitive information Logger *zap.SugaredLogger `db:"-"` // contains filtered or unexported fields }
func (*Channel) IncrementalInitAndValidate ¶
IncrementalInitAndValidate implements the config.IncrementalConfigurableInitAndValidatable interface.
func (*Channel) MarshalLogObject ¶
func (c *Channel) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
func (*Channel) Notify ¶
func (c *Channel) Notify(contact *recipient.Contact, i contracts.Incident, ev *event.Event, icingaweb2Url string) error
Notify prepares and sends the notification request, returns a non-error on fails, nil on success
func (*Channel) Restart ¶
func (c *Channel) Restart()
Restart signals to restart the channel plugin with the updated channel config
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func NewPlugin ¶
func NewPlugin(pluginType string, logger *zap.SugaredLogger) (*Plugin, error)
NewPlugin starts and returns a new plugin instance. If the start of the plugin fails, an error is returned
func (*Plugin) GetInfo ¶
GetInfo sends the PluginInfo request and returns the response or an error if an error occurred
func (*Plugin) SendNotification ¶
func (p *Plugin) SendNotification(req *plugin.NotificationRequest) error
SendNotification sends the notification, returns an error if fails