Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Email string `validate:"required"` Name string `validate:"required"` Surname string `validate:"required"` }
Address struct will be used to send the notification to the given Address.Email and also as the input for the message template
type AlertError ¶
type AlertError struct {
// contains filtered or unexported fields
}
AlertError for errors which occurred during the alert send operation
func (AlertError) Unwrap ¶
func (ae AlertError) Unwrap() error
Unwrap can be used by the errors package to access the underlying error
type EmailClient ¶
type EmailClient struct {
// contains filtered or unexported fields
}
EmailClient struct implements the Notifier interface and can send alert and resolve notifications
func NewEmailClient ¶
func NewEmailClient(config *EmailClientConfig, repo EmailReceiverRepository, logger *log.Logger) (*EmailClient, error)
NewEmailClient inits an EmailClient which can send e-mails for alert and resolve notifications
func (*EmailClient) Alert ¶
func (e *EmailClient) Alert(ctx context.Context) error
Alert sends notification to the given receiver audience. Email Subject will contain the noun "alert" as prefix.
func (*EmailClient) Name ¶
func (e *EmailClient) Name() string
Name gives the name of the email notifier
type EmailClientConfig ¶
type EmailClientConfig struct { Sender EmailSender `validate:"required"` FromEmailAddress string `validate:"required"` }
EmailClientConfig struct holds all required parameters for the EmailClient
type EmailMessageBuildError ¶
type EmailMessageBuildError struct {
// contains filtered or unexported fields
}
EmailMessageBuildError represents all messages that could not be built with the template and the given address input
func (EmailMessageBuildError) Error ¶
func (e EmailMessageBuildError) Error() string
Error formats the EmailMessageBuildError to a nice error message
type EmailReceiver ¶
type EmailReceiver struct { Name string `validate:"required"` AlertSubject string `validate:"required"` ResolveSubject string `validate:"required"` AlertTemplateMessage string `validate:"required"` ResolveTemplateMessage string `validate:"required"` Addresses []Address `validate:"required,dive,required"` }
EmailReceiver struct
type EmailReceiverRepository ¶
type EmailReceiverRepository interface {
GetEmailReceivers(ctx context.Context) ([]EmailReceiver, error)
}
type EmailSender ¶
type EmailSender interface {
DialAndSend(message ...*gomail.Message) error
}
EmailSender interface
type ResolveError ¶
type ResolveError struct {
// contains filtered or unexported fields
}
ResolveError for errors which occurred during the alert send operation
func (ResolveError) Unwrap ¶
func (re ResolveError) Unwrap() error
Unwrap can be used by the errors package to access the underlying error
Directories ¶
Path | Synopsis |
---|---|
Package mock_notifier is a generated GoMock package.
|
Package mock_notifier is a generated GoMock package. |