notifier

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package notifier implements webhook notifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertPayload

type AlertPayload struct {
	Timestamp    time.Time `json:"timestamp"`
	AlertName    string    `json:"alert_name"`
	Status       string    `json:"status"`
	Condition    string    `json:"condition"`
	Timeframe    string    `json:"timeframe"`
	AlertID      int       `json:"alert_id"`
	ProjectID    int       `json:"project_id"`
	TeamID       int       `json:"team_id"`
	Threshold    int       `json:"threshold"`
	HighPriority bool      `json:"high_priority"`
}

AlertPayload represents the webhook payload for alert notifications.

type WebhookNotifier

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

WebhookNotifier sends notifications via HTTP webhooks.

func NewWebhookNotifier

func NewWebhookNotifier(
	store warnly.NotificationStore,
	encryptionKey []byte,
	httpClient *http.Client,
	now func() time.Time,
	logger *slog.Logger,
) *WebhookNotifier

NewWebhookNotifier creates a new WebhookNotifier.

func (*WebhookNotifier) DecryptSecret

func (wn *WebhookNotifier) DecryptSecret(encryptedSecret string) (string, error)

DecryptSecret decrypts a webhook secret using AES-GCM.

func (*WebhookNotifier) EncryptSecret

func (wn *WebhookNotifier) EncryptSecret(secret string) (string, error)

EncryptSecret encrypts a webhook secret using AES-GCM.

func (*WebhookNotifier) SendAlertResolved

func (wn *WebhookNotifier) SendAlertResolved(ctx context.Context, alert *warnly.Alert, config *warnly.WebhookConfig) error

SendAlertResolved sends an alert resolved notification.

func (*WebhookNotifier) SendAlertTriggered

func (wn *WebhookNotifier) SendAlertTriggered(ctx context.Context, alert *warnly.Alert, config *warnly.WebhookConfig) error

SendAlertTriggered sends an alert triggered notification.

func (*WebhookNotifier) SendWebhook

func (wn *WebhookNotifier) SendWebhook(ctx context.Context, config *warnly.WebhookConfig, payload *AlertPayload) error

SendWebhook sends a webhook notification.

Jump to

Keyboard shortcuts

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