Documentation
¶
Index ¶
- func BuildAutoHealNotificationMessage(format MessageFormat, environmentName, containerName string) string
- func BuildBatchImageUpdateNotificationMessage(format MessageFormat, environmentName string, ...) string
- func BuildContainerUpdateNotificationMessage(format MessageFormat, ...) string
- func BuildDiscordURL(config models.DiscordConfig) (string, error)
- func BuildEmailSubject(environmentName, subject string) string
- func BuildGenericURL(config models.GenericConfig) (string, error)
- func BuildGotifyURL(config models.GotifyConfig) (string, error)
- func BuildImageUpdateNotificationMessage(format MessageFormat, environmentName, imageRef string, ...) string
- func BuildMatrixURL(config models.MatrixConfig) (string, error)
- func BuildNtfyURL(config models.NtfyConfig) (string, error)
- func BuildPruneReportNotificationMessage(format MessageFormat, environmentName string, result *system.PruneAllResult) string
- func BuildPushoverURL(config models.PushoverConfig) (string, error)
- func BuildSignalURL(config models.SignalConfig) (string, error)
- func BuildSlackURL(config models.SlackConfig) (string, error)
- func BuildTelegramURL(config models.TelegramConfig) (string, error)
- func BuildVulnerabilitySummaryNotificationMessage(format MessageFormat, ...) string
- func DecodeConfig[T any](config models.JSON, providerName string) (T, error)
- func DecryptStringCredential(value *string) error
- func Deliver(ctx context.Context, provider models.NotificationProvider, config models.JSON, ...) (handled bool, err error)
- func FormatBytes(bytes uint64) string
- func PrepareGotifyConfig(config models.JSON, providerName string) (models.GotifyConfig, error)
- func PrepareMatrixConfig(config models.JSON) (models.MatrixConfig, error)
- func PrepareNtfyConfig(config models.JSON, providerName string, requireTopic bool) (models.NtfyConfig, error)
- func PreparePushoverConfig(config models.JSON, providerName string) (models.PushoverConfig, error)
- func PrepareSlackConfig(config models.JSON, providerName string, requireToken bool) (models.SlackConfig, error)
- func SanitizeForEmail(text string) string
- func SendDiscord(ctx context.Context, config models.DiscordConfig, message string) error
- func SendEmail(ctx context.Context, config models.EmailConfig, subject, htmlBody string) error
- func SendGenericWithTitle(ctx context.Context, config models.GenericConfig, title, message string) error
- func SendGotify(ctx context.Context, config models.GotifyConfig, message string) error
- func SendMatrix(ctx context.Context, config models.MatrixConfig, message string) error
- func SendNtfy(ctx context.Context, config models.NtfyConfig, message string) error
- func SendPushover(ctx context.Context, config models.PushoverConfig, message string) error
- func SendSignal(ctx context.Context, config models.SignalConfig, message string) error
- func SendSlack(ctx context.Context, config models.SlackConfig, message string) error
- func SendTelegram(ctx context.Context, config models.TelegramConfig, message string) error
- func TextByFormat(build func(MessageFormat) string) map[MessageFormat]string
- type Content
- type MessageFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAutoHealNotificationMessage ¶
func BuildAutoHealNotificationMessage(format MessageFormat, environmentName, containerName string) string
func BuildBatchImageUpdateNotificationMessage ¶
func BuildBatchImageUpdateNotificationMessage(format MessageFormat, environmentName string, updates map[string]*imageupdate.Response) string
func BuildContainerUpdateNotificationMessage ¶
func BuildContainerUpdateNotificationMessage(format MessageFormat, environmentName, containerName, imageRef, oldDigest, newDigest string) string
func BuildDiscordURL ¶
func BuildDiscordURL(config models.DiscordConfig) (string, error)
BuildDiscordURL converts DiscordConfig to Shoutrrr URL format using shoutrrr's Config
func BuildEmailSubject ¶
func BuildGenericURL ¶
func BuildGenericURL(config models.GenericConfig) (string, error)
BuildGenericURL converts GenericConfig to Shoutrrr URL format for generic webhooks
func BuildGotifyURL ¶
func BuildGotifyURL(config models.GotifyConfig) (string, error)
BuildGotifyURL converts GotifyConfig to Shoutrrr URL format URL example: gotify://host[:port][/path]/token[?query]
func BuildImageUpdateNotificationMessage ¶
func BuildImageUpdateNotificationMessage(format MessageFormat, environmentName, imageRef string, updateInfo *imageupdate.Response) string
func BuildMatrixURL ¶
func BuildMatrixURL(config models.MatrixConfig) (string, error)
BuildMatrixURL converts MatrixConfig to Shoutrrr URL format URL example: matrix://user:password@host[:port]/[?rooms=!roomID1[,roomAlias2]][&disableTLS=yes]
func BuildNtfyURL ¶
func BuildNtfyURL(config models.NtfyConfig) (string, error)
BuildNtfyURL converts NtfyConfig to Shoutrrr URL format URL example: ntfy://[user:password@]host[:port]/topic[?query]
func BuildPruneReportNotificationMessage ¶
func BuildPruneReportNotificationMessage(format MessageFormat, environmentName string, result *system.PruneAllResult) string
func BuildPushoverURL ¶
func BuildPushoverURL(config models.PushoverConfig) (string, error)
BuildPushoverURL converts PushoverConfig to Shoutrrr URL format. URL example: pushover://:token@user?devices=device1,device2&priority=1&title=Container+Update
func BuildSignalURL ¶
func BuildSignalURL(config models.SignalConfig) (string, error)
BuildSignalURL converts SignalConfig to Shoutrrr URL format using shoutrrr's Config
func BuildSlackURL ¶
func BuildSlackURL(config models.SlackConfig) (string, error)
BuildSlackURL converts SlackConfig to Shoutrrr URL format using shoutrrr's Config
func BuildTelegramURL ¶
func BuildTelegramURL(config models.TelegramConfig) (string, error)
BuildTelegramURL converts TelegramConfig to Shoutrrr URL format using shoutrrr's Config
func BuildVulnerabilitySummaryNotificationMessage ¶
func BuildVulnerabilitySummaryNotificationMessage(format MessageFormat, environmentName, summaryLabel, overview, fixableCount, severityBreakdown, sampleCVEs string) string
func DecodeConfig ¶ added in v2.1.0
DecodeConfig round-trips a provider config (models.JSON) into a typed struct T.
func DecryptStringCredential ¶ added in v2.1.0
DecryptStringCredential decrypts an encrypted credential in place. A value that fails to decrypt but is not plausibly ciphertext is treated as a legacy raw value.
func Deliver ¶ added in v2.3.2
func Deliver(ctx context.Context, provider models.NotificationProvider, config models.JSON, c Content) (handled bool, err error)
Deliver sends c to a single provider. handled is false for unknown providers.
func FormatBytes ¶
func PrepareGotifyConfig ¶ added in v2.1.0
PrepareGotifyConfig decodes and decrypts a Gotify provider config.
func PrepareMatrixConfig ¶ added in v2.1.0
func PrepareMatrixConfig(config models.JSON) (models.MatrixConfig, error)
PrepareMatrixConfig decodes and decrypts a Matrix provider config.
func PrepareNtfyConfig ¶ added in v2.1.0
func PrepareNtfyConfig(config models.JSON, providerName string, requireTopic bool) (models.NtfyConfig, error)
PrepareNtfyConfig decodes and decrypts an ntfy provider config.
func PreparePushoverConfig ¶ added in v2.1.0
PreparePushoverConfig decodes and decrypts a Pushover provider config.
func PrepareSlackConfig ¶ added in v2.1.0
func PrepareSlackConfig(config models.JSON, providerName string, requireToken bool) (models.SlackConfig, error)
PrepareSlackConfig decodes and decrypts a Slack provider config.
func SanitizeForEmail ¶
SanitizeForEmail sanitizes text for safe use in email subjects
func SendDiscord ¶
SendDiscord sends a message via Shoutrrr Discord using proper service configuration
func SendGenericWithTitle ¶
func SendGenericWithTitle(ctx context.Context, config models.GenericConfig, title, message string) error
SendGenericWithTitle sends a message with title via Shoutrrr Generic webhook. When config.SuccessBodyContains is set the response body is also inspected — this is necessary for providers (e.g. PushPlus) that always return HTTP 200 but embed a success/failure indicator inside the JSON body.
func SendGotify ¶
SendGotify sends a message via Shoutrrr Gotify using proper service configuration
func SendMatrix ¶
SendMatrix sends a message via Shoutrrr Matrix using proper service configuration
func SendPushover ¶
SendPushover sends a message via Shoutrrr Pushover using proper service configuration.
func SendSignal ¶
SendSignal sends a message via Shoutrrr Signal using proper service configuration
func SendTelegram ¶
SendTelegram sends a message via Shoutrrr Telegram using proper service configuration
func TextByFormat ¶ added in v2.3.2
func TextByFormat(build func(MessageFormat) string) map[MessageFormat]string
TextByFormat builds the per-format message map for Content.Text from a single messages.go builder closure.
Types ¶
type Content ¶ added in v2.3.2
type Content struct {
// Text holds the message body per format, built once per fan-out via the
// messages.go builders.
Text map[MessageFormat]string
// Title is the generic-webhook title.
Title string
// DefaultTitle is applied to pushover/gotify when their config has no
// title; "" means don't default.
DefaultTitle string
// RenderEmail lazily renders the email subject and HTML body. Built as a
// closure by the caller so template resources and app config stay out of
// this package. Nil means the provider map's email deliverer errors.
RenderEmail func() (subject, html string, err error)
// RequireNtfyTopic preserves the per-event ntfy topic validation.
RequireNtfyTopic bool
// ValidatePushoverUser preserves the per-event pushover token/user validation.
ValidatePushoverUser bool
}
Content is the provider-independent description of one notification: the message text per format plus the per-event knobs that vary between events.
type MessageFormat ¶
type MessageFormat string
const ( MessageFormatPlain MessageFormat = "plain" MessageFormatMarkdown MessageFormat = "markdown" MessageFormatSlack MessageFormat = "slack" MessageFormatHTML MessageFormat = "html" )