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 BuildGoogleChatURL(config models.GoogleChatConfig) (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 EventVars(environmentName, environmentID string, event models.NotificationEventType) map[string]string
- 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 RenderGenericPayloadTemplate(config models.GenericConfig, title, message string, vars map[string]string) (string, 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 SendGoogleChat(ctx context.Context, config models.GoogleChatConfig, 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
- func ValidateGenericPayloadTemplate(config models.GenericConfig) error
- 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 BuildGoogleChatURL ¶ added in v2.7.0
func BuildGoogleChatURL(config models.GoogleChatConfig) (string, error)
BuildGoogleChatURL converts GoogleChatConfig to Shoutrrr URL format by swapping the incoming webhook URL's scheme to googlechat while preserving the host, path and the key/token query parameters.
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 EventVars ¶ added in v2.7.0
func EventVars(environmentName, environmentID string, event models.NotificationEventType) map[string]string
EventVars builds the per-event variables exposed to a generic webhook payload template. The names must stay clear of Shoutrrr generic config keys (title, template, contenttype, method, messagekey, titlekey, disabletls) — a colliding param would mutate the per-send service config.
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 RenderGenericPayloadTemplate ¶ added in v2.7.0
func RenderGenericPayloadTemplate(config models.GenericConfig, title, message string, vars map[string]string) (string, error)
RenderGenericPayloadTemplate renders the configured payload template with the same variables the Shoutrrr send path exposes. Used by the direct-HTTP path (SuccessBodyContains) and by save-time validation.
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, vars map[string]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 SendGoogleChat ¶ added in v2.7.0
SendGoogleChat sends a message via Shoutrrr's Google Chat service. The service posts plain text only ({"text": ...}) and ignores params, so the title is expected to already be part of the message 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.
func ValidateGenericPayloadTemplate ¶ added in v2.7.0
func ValidateGenericPayloadTemplate(config models.GenericConfig) error
ValidateGenericPayloadTemplate checks a configured payload template at save time: it must parse, execute against sample variables, and — when the content type is JSON (the default) — render valid JSON. Shoutrrr renders the template internally at send time, so validating here surfaces mistakes against the user's own configuration instead of as an opaque send failure.
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)
// Vars carries per-event variables (environment, environmentId, event,
// timestamp) for the generic webhook's payload template. They are only
// injected into the outgoing request when a payload template is configured,
// so existing template-less generic webhooks keep their exact payload.
Vars map[string]string
// 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" )