notify

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSinks = errors.New("no sinks configured")

Functions

This section is empty.

Types

type Config

type Config struct {
	Routes            []Route
	IdempotencyKeyTTL time.Duration
}

type DeviceSelector added in v0.0.3

type DeviceSelector struct {
	Names  []string
	Tags   []string
	Owners []string
	IPs    []string
}

type DiscordSink

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

func NewDiscordSink

func NewDiscordSink(name, url string, logger *zap.Logger) *DiscordSink

func (*DiscordSink) Name

func (s *DiscordSink) Name() string

func (*DiscordSink) Send

func (s *DiscordSink) Send(ctx context.Context, n Notification) error

type Notification

type Notification struct {
	Event          event.Event `json:"event"`
	IdempotencyKey string      `json:"idempotency_key"`
}

type Notifier

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

func New

func New(cfg Config, store state.StateStore, sinks []Sink) *Notifier

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, events []event.Event, dryRun bool) (Result, error)

type Result

type Result struct {
	Sent       int
	Suppressed int
	DryRun     int
}

type Route

type Route struct {
	EventTypes []string
	Severities []string
	Sinks      []string
	Device     DeviceSelector
}

type Sink

type Sink interface {
	Name() string
	Send(ctx context.Context, n Notification) error
}

type StdoutSink

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

func NewStdoutSink

func NewStdoutSink(name string, w io.Writer) *StdoutSink

func (*StdoutSink) Name

func (s *StdoutSink) Name() string

func (*StdoutSink) Send

type WebhookSink

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

func NewWebhookSink

func NewWebhookSink(name, url string, logger *zap.Logger) *WebhookSink

func (*WebhookSink) Name

func (s *WebhookSink) Name() string

func (*WebhookSink) Send

func (s *WebhookSink) Send(ctx context.Context, n Notification) error

Jump to

Keyboard shortcuts

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