notifiers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package notifiers contains notifier implementations and a notifier registry.

Built-in supported notifiers are housed here. These notifiers can be used by the monitor to send Github Status change notifications to external systems.

Index

Constants

View Source
const (
	File = "file"
)
View Source
const (
	Slack = "slack"
)
View Source
const (
	Stdout = "stdout"
)

Variables

This section is empty.

Functions

func GetNotifier

func GetNotifier(log *zap.Logger, name string) (notifier.Notifier, error)

GetNotifier will retrieve the notifier with the given name.

func ListNotifiers

func ListNotifiers() []string

ListNotifiers will list all notifier names.

func NewFileNotifier

func NewFileNotifier(_ *zap.Logger) (notifier.Notifier, error)

NewFileNotifier will return a file notifier.

func NewSlackNotifier

func NewSlackNotifier(log *zap.Logger) (notifier.Notifier, error)

NewSlackNotifier will return a Slack notifier.

func NewStdoutNotifier

func NewStdoutNotifier(_ *zap.Logger) (notifier.Notifier, error)

NewStdoutNotifier will return an stdout notifier.

func RegisterCommandFlags

func RegisterCommandFlags(cmd *cobra.Command)

RegisterCommandFlags will register CLI flags for all commands with the given command.

func RegisterNotifier

func RegisterNotifier(name string, creator NotifierCreator) error

RegisterNotifier will register the given notifier and the given notifier creation function.

Types

type FileNotifier

type FileNotifier struct {
	*WriterNotifier
	// contains filtered or unexported fields
}

FileNotifier writes the output to the given file.

func (*FileNotifier) Cleanup

func (f *FileNotifier) Cleanup() error

Cleanup performs any cleanup steps.

func (*FileNotifier) Name

func (*FileNotifier) Name() string

Name is the name of the notifier.

type NotifierCreator

type NotifierCreator func(log *zap.Logger) (notifier.Notifier, error)

NotifierCreator creates a notifier.

type SlackNotifier

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

SlackNotifier writes the output to Slack.

func (*SlackNotifier) Cleanup

func (s *SlackNotifier) Cleanup() error

Cleanup performs any cleanup steps.

func (*SlackNotifier) Name

func (*SlackNotifier) Name() string

Name is the name of the notifier.

func (*SlackNotifier) Notify

func (s *SlackNotifier) Notify(ctx context.Context, msg notifier.Message) error

Notify will notify an underlying system with the given message.

type StdoutNotifier

type StdoutNotifier struct {
	*WriterNotifier
}

StdoutNotifier writes the output to stdout.

func (*StdoutNotifier) Name

func (*StdoutNotifier) Name() string

Name is the name of the notifier.

type WriterNotifier

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

WriterNotifier writes the output to the given io.Writer. This is meant to be used by other notifiers and not directly, so it is not registered with the notifier registry.

func NewWriterNotifier

func NewWriterNotifier(writer io.Writer) *WriterNotifier

NewWriterNotifier will return a writer notifier.

func (*WriterNotifier) Cleanup

func (w *WriterNotifier) Cleanup() error

Cleanup performs any cleanup steps.

func (*WriterNotifier) Name

func (*WriterNotifier) Name() string

Name is the name of the notifier.

func (*WriterNotifier) Notify

func (w *WriterNotifier) Notify(_ context.Context, msg notifier.Message) error

Notify will notify an underlying system with the given message.

Jump to

Keyboard shortcuts

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