Documentation
¶
Overview ¶
Package notifier implements webhook notifications.
Index ¶
- type AlertPayload
- type WebhookNotifier
- func (wn *WebhookNotifier) DecryptSecret(encryptedSecret string) (string, error)
- func (wn *WebhookNotifier) EncryptSecret(secret string) (string, error)
- func (wn *WebhookNotifier) SendAlertResolved(ctx context.Context, alert *warnly.Alert, config *warnly.WebhookConfig) error
- func (wn *WebhookNotifier) SendAlertTriggered(ctx context.Context, alert *warnly.Alert, config *warnly.WebhookConfig) error
- func (wn *WebhookNotifier) SendWebhook(ctx context.Context, config *warnly.WebhookConfig, payload *AlertPayload) error
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.
Click to show internal directories.
Click to hide internal directories.