notification

package
v0.0.0-...-c5ab296 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSender

func RegisterSender(name string, s Sender)

RegisterSender makes a Sender available by the provided name.

If called twice with the same name, the name is blank, or if the provided Sender is nil, this function panics.

Types

type Config

type Config struct {
	Attempts int
	Level    types.Level
	Params   map[string]interface{} `yaml:",inline"`
}

Config is the configuration for the Notifier service and its registered notifiers.

type DefaultNotificationSender

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

DefaultNotificationSender - default notification sender, manages configuration

func New

New - create new sender

func (*DefaultNotificationSender) Configure

func (m *DefaultNotificationSender) Configure(config *Config) (bool, error)

Configure - configure is used to register multiple notification senders

func (*DefaultNotificationSender) Send

Send - send notifications through all configured senders

func (*DefaultNotificationSender) Senders

func (m *DefaultNotificationSender) Senders() map[string]Sender

Senders returns the list of the registered Senders.

func (*DefaultNotificationSender) UnregisterSender

func (m *DefaultNotificationSender) UnregisterSender(name string)

UnregisterSender removes a Sender with a particular name from the list.

type Sender

type Sender interface {
	// Configure attempts to initialize the notifier with the provided configuration.
	// It returns whether the notifier is enabled or not.
	Configure(*Config) (bool, error)

	// Send informs the existence of the specified notification.
	Send(event types.EventNotification) error
}

Sender represents anything that can transmit notifications.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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