notification

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package notification provides a mechanism to send notifications for various events.

Index

Constants

This section is empty.

Variables

View Source
var AdditionalSenders []sender.Sender

AdditionalSenders is a list of additional senders that will be used in addition to the senders configured in the repository.

View Source
var SeverityToNumber = map[string]Severity{
	"verbose": SeverityVerbose,
	"success": SeveritySuccess,
	"report":  SeverityReport,
	"warning": SeverityWarning,
	"error":   SeverityError,
}

SeverityToNumber maps severity names to numbers.

View Source
var SeverityToString map[Severity]string

SeverityToString maps severity numbers to names.

Functions

func Send

func Send(ctx context.Context, rep repo.Repository, templateName string, eventArgs notifydata.TypedEventArgs, sev Severity, opt notifytemplate.Options)

Send sends a notification for the given event. Any errors encountered during the process are logged.

func SendInternal

func SendInternal(ctx context.Context, rep repo.Repository, templateName string, eventArgs notifydata.TypedEventArgs, sev Severity, opt notifytemplate.Options) error

SendInternal sends a notification for the given event and returns an error.

func SendTestNotification

func SendTestNotification(ctx context.Context, rep repo.Repository, s sender.Sender) error

SendTestNotification sends a test notification to the given sender.

func SendTo

func SendTo(ctx context.Context, rep repo.Repository, s sender.Sender, templateName string, eventArgs notifydata.TypedEventArgs, sev Severity, opt notifytemplate.Options) error

SendTo sends a notification to the given sender.

Types

type Severity

type Severity = sender.Severity

Severity represents the severity of a notification message.

const (
	// SeverityVerbose includes all notification messages, including frequent and verbose ones.
	SeverityVerbose Severity = -100

	// SeveritySuccess is used for successful operations.
	SeveritySuccess Severity = -10

	// SeverityDefault includes notification messages enabled by default.
	SeverityDefault Severity = 0

	// SeverityReport is used for periodic reports.
	SeverityReport Severity = 0

	// SeverityWarning is used for warnings about potential issues.
	SeverityWarning Severity = 10

	// SeverityError is used for errors that require attention.
	SeverityError Severity = 20
)

type TemplateArgs

type TemplateArgs struct {
	Hostname          string
	EventTime         time.Time
	EventArgs         any
	EventArgsType     grpcapi.NotificationEventArgType
	KopiaRepo         string
	KopiaBuildInfo    string
	KopiaBuildVersion string
}

TemplateArgs represents the arguments passed to the notification template when rendering.

func MakeTemplateArgs

func MakeTemplateArgs(eventArgs notifydata.TypedEventArgs) TemplateArgs

MakeTemplateArgs wraps event-specific arguments into TemplateArgs object.

Directories

Path Synopsis
Package notifydata contains the data structures used by the notification package.
Package notifydata contains the data structures used by the notification package.
Package notifyprofile notification profile management.
Package notifyprofile notification profile management.
Package notifytemplate provides a way to access notification templates.
Package notifytemplate provides a way to access notification templates.
Package sender provides a common interface for sending notifications.
Package sender provides a common interface for sending notifications.
email
Package email provides email notification support.
Package email provides email notification support.
jsonsender
Package jsonsender provides a notification sender that writes messages in JSON format to the provided writer.
Package jsonsender provides a notification sender that writes messages in JSON format to the provided writer.
pushover
Package pushover provides pushover notification support.
Package pushover provides pushover notification support.
testsender
Package testsender provides notification sender testing support.
Package testsender provides notification sender testing support.
webhook
Package webhook provides webhook notification support.
Package webhook provides webhook notification support.

Jump to

Keyboard shortcuts

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