Documentation
¶
Overview ¶
Package notifyalert sends the platform's own alerts -- a review queue past its threshold, a connection whose credential was revoked, a scheduled run that failed -- to the notification channels an operator named for each, beside the email recipients those alerts already reach (#1724).
An alert sent to a channel is authorized as the platform. The operator who named the channel in the alert's settings is the authorization, as naming a recipient is: no persona is consulted, and the send is charged to no actor. Each alert passes its own key, so the channel's repeat window applies to an alert that keeps firing.
Index ¶
Constants ¶
const MaxChannels = 10
MaxChannels bounds the channels one alert names, as notification.MaxChannelRecipients bounds an email list.
Variables ¶
var ErrUnknownChannel = errors.New("no notification channel has that name")
ErrUnknownChannel is wrapped by Validate for a name no channel is stored under.
Functions ¶
func Normalize ¶
Normalize trims a submitted channel list, dropping blanks and repeats, so a form's empty last line or a doubled entry is not stored.
func Validate ¶
func Validate(ctx context.Context, store notification.ChannelStore, names []string) error
Validate refuses a channel list an alert cannot send to: too many entries, or a name no channel is stored under. A channel that exists but is disabled is accepted, as it is everywhere else an operator names one: enabling it later should not mean re-entering it here.
Types ¶
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender sends an alert to channels. A nil Sender sends nothing, which is how a deployment with no channels is wired.
func New ¶
func New(channels notification.ChannelStore, enqueuer *notification.Enqueuer) *Sender
New builds a Sender, or nil when either dependency is absent.