27 lines
856 B
Go
27 lines
856 B
Go
package mail
|
|
|
|
import "time"
|
|
|
|
// MonitorEvent is a monitor state transition, as the control plane's
|
|
// notification dispatcher sees it. It lives here rather than in server/ so that
|
|
// the email templates and the caller agree on the fields without server's model
|
|
// package leaking into shared.
|
|
type MonitorEvent struct {
|
|
MonitorName string
|
|
Type string
|
|
OldStatus string
|
|
NewStatus string
|
|
Message string
|
|
Time time.Time
|
|
|
|
// Down drives the pill and the subject verb. The caller decides it, since
|
|
// only server/ knows which status strings mean down.
|
|
Down bool
|
|
}
|
|
|
|
// SendMonitorAlert delivers one state-change notification to an SMTP
|
|
// notification channel's recipients, which may be a comma-separated list.
|
|
func (s Sender) SendMonitorAlert(to string, ev MonitorEvent) error {
|
|
return s.sendTemplate(to, "", "monitoralert", ev)
|
|
}
|