channel

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

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

func ValidateType(t string) error

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

func (c *Channel) IncrementalInitAndValidate() error

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

func (*Channel) Start

func (c *Channel) Start(ctx context.Context, logger *zap.SugaredLogger)

Start initializes the channel and starts the plugin in the background

func (*Channel) Stop

func (c *Channel) Stop()

Stop ends the lifecycle of its plugin. This should only be called when the channel is not more required.

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

func (p *Plugin) GetInfo() (*plugin.Info, error)

GetInfo sends the PluginInfo request and returns the response or an error if an error occurred

func (*Plugin) Pid

func (p *Plugin) Pid() int

func (*Plugin) SendNotification

func (p *Plugin) SendNotification(req *plugin.NotificationRequest) error

SendNotification sends the notification, returns an error if fails

func (*Plugin) SetConfig

func (p *Plugin) SetConfig(config string) error

SetConfig sends the setConfig request with given config, returns an error if an error occurred

func (*Plugin) Stop

func (p *Plugin) Stop()

Stop stops the plugin. Multiple calls are safe because sync.Once is used internally

Jump to

Keyboard shortcuts

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