28 lines
834 B
Go
28 lines
834 B
Go
// Package notify sends drift/error notifications to project-configured
|
|
// channels (Telegram, generic webhooks, ...). Notifier implementations must
|
|
// never log the secret they receive (bot tokens, HMAC keys, etc.).
|
|
package notify
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Event describes a single notification-worthy occurrence for a domain
|
|
// belonging to a project (e.g. a status change detected by the scheduler).
|
|
type Event struct {
|
|
Project string
|
|
Domain string
|
|
Status string
|
|
Summary string
|
|
At time.Time
|
|
}
|
|
|
|
// Notifier delivers an Event to a channel described by cfg (channel-type
|
|
// specific JSON config) and secret (decrypted credential, e.g. a bot token).
|
|
// Implementations must not log secret.
|
|
type Notifier interface {
|
|
Send(ctx context.Context, cfg json.RawMessage, secret string, ev Event) error
|
|
}
|