Documentation
¶
Overview ¶
Package notification provides a mechanism to send notifications for various events.
Index ¶
- Variables
- func Send(ctx context.Context, rep repo.Repository, templateName string, ...)
- func SendInternal(ctx context.Context, rep repo.Repository, templateName string, ...) error
- func SendTestNotification(ctx context.Context, rep repo.Repository, s sender.Sender) error
- func SendTo(ctx context.Context, rep repo.Repository, s sender.Sender, templateName string, ...) error
- type Severity
- type TemplateArgs
Constants ¶
This section is empty.
Variables ¶
var AdditionalSenders []sender.Sender
AdditionalSenders is a list of additional senders that will be used in addition to the senders configured in the repository.
var SeverityToNumber = map[string]Severity{ "verbose": SeverityVerbose, "success": SeveritySuccess, "report": SeverityReport, "warning": SeverityWarning, "error": SeverityError, }
SeverityToNumber maps severity names to numbers.
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 ¶
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 ¶
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. |