notification

package
v0.0.0-...-6bdf688 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPublisher

func RegisterPublisher(name string, p Publisher)

RegisterPublisher 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
	Params   map[string]interface{} `yaml:",inline"`
}

Config is the configuration for the publicher service and its registered publishers.

type DefaultNotificationPublisher

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

DefaultNotificationPublisher - default notification publisher, manages configuration

func New

New - create new publisher

func (*DefaultNotificationPublisher) Configure

func (p *DefaultNotificationPublisher) Configure(config *Config) (bool, error)

Configure - configure is used to register multiple notification publishers

func (*DefaultNotificationPublisher) PublishCommit

Send - send notifications through all configured publishers

func (*DefaultNotificationPublisher) Publishers

func (p *DefaultNotificationPublisher) Publishers() map[string]Publisher

Publishers returns the list of the registered Publishers.

func (*DefaultNotificationPublisher) UnregisterPublisher

func (p *DefaultNotificationPublisher) UnregisterPublisher(name string)

UnregisterPublisher removes a publisher with a particular name from the list.

type Publisher

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

	// PublishCommit informs the existence of the specified notification.
	PublishCommit(event *types.CommitNotification) error
}

Publisher 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