Documentation
¶
Index ¶
- Variables
- type Config
- type Diagnostic
- type HandlerConfig
- type Service
- func (s *Service) Close() error
- func (s *Service) Global() bool
- func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) alert.Handler
- func (s *Service) Open() error
- func (s *Service) SendMail(to []string, subject, body string) error
- func (s *Service) StateChangesOnly() bool
- func (s *Service) Test(options interface{}) error
- func (s *Service) TestOptions() interface{}
- func (s *Service) Update(newConfig []interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoRecipients = errors.New("not sending email, no recipients defined")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enabled bool `toml:"enabled" override:"enabled"`
Host string `toml:"host" override:"host"`
Port int `toml:"port" override:"port"`
Username string `toml:"username" override:"username"`
Password string `toml:"password" override:"password,redact"`
// Whether to skip TLS verify.
NoVerify bool `toml:"no-verify" override:"no-verify"`
// Whether all alerts should trigger an email.
Global bool `toml:"global" override:"global"`
// Whether all alerts should automatically use stateChangesOnly mode.
// Only applies if global is also set.
StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`
// From address
From string `toml:"from" override:"from"`
// Default To addresses
To []string `toml:"to" override:"to"`
//ToTemplates is the field or value to grab which address to send an email to
ToTemplates []string `toml:"toTemplates" override:"to-templates"`
// Close connection to SMTP server after idle timeout has elapsed
IdleTimeout toml.Duration `toml:"idle-timeout" override:"idle-timeout"`
}
type Diagnostic ¶ added in v1.4.0
type Diagnostic interface {
WithContext(ctx ...keyvalue.T) Diagnostic
Error(msg string, err error)
}
type HandlerConfig ¶ added in v1.2.0
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(c Config, d Diagnostic) *Service
func (*Service) StateChangesOnly ¶ added in v0.11.0
func (*Service) TestOptions ¶ added in v1.1.0
func (s *Service) TestOptions() interface{}
Click to show internal directories.
Click to hide internal directories.