Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(alerting): Add AWS SES Alerting Provider #579

Merged
merged 15 commits into from
Oct 26, 2023
Prev Previous commit
Next Next commit
Use aws.slice to convert string array & rename awsses -> aws-ses
beschoenen committed Sep 27, 2023
commit 09b8b419d22495845edb08319e61d1a60b8b1f54
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1077,6 +1077,8 @@ endpoints:
description: "healthcheck failed"
```

Make sure you have the ability to use `ses:SendEmail`.


#### Configuring custom alerts
| Parameter | Description | Default |
4 changes: 2 additions & 2 deletions alerting/config.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import (

"github.com/TwiN/gatus/v5/alerting/alert"
"github.com/TwiN/gatus/v5/alerting/provider"
"github.com/TwiN/gatus/v5/alerting/provider/awsses"
"github.com/TwiN/gatus/v5/alerting/provider/aws-ses"
"github.com/TwiN/gatus/v5/alerting/provider/custom"
"github.com/TwiN/gatus/v5/alerting/provider/discord"
"github.com/TwiN/gatus/v5/alerting/provider/email"
@@ -30,7 +30,7 @@ import (
// Config is the configuration for alerting providers
type Config struct {
// AWSSes is the configuration for the aws-ses alerting provider
AWSSimpleEmailService *awsses.AlertProvider `yaml:"aws-ses,omitempty"`
AWSSimpleEmailService *aws_ses.AlertProvider `yaml:"aws-ses,omitempty"`

// Custom is the configuration for the custom alerting provider
Custom *custom.AlertProvider `yaml:"custom,omitempty"`
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package awsses
package aws_ses

import (
"fmt"
@@ -65,16 +65,11 @@ func (provider *AlertProvider) Send(endpoint *core.Endpoint, alert *alert.Alert,
svc := ses.New(sess)

subject, body := provider.buildMessageSubjectAndBody(endpoint, alert, result, resolved)

emails := strings.Split(provider.getToForGroup(endpoint.Group), ",")
var CCEmails []*string
for _, cc := range emails {
CCEmails = append(CCEmails, &cc)
}

input := &ses.SendEmailInput{
Destination: &ses.Destination{
ToAddresses: CCEmails,
ToAddresses: aws.StringSlice(emails),
},
Message: &ses.Message{
Body: &ses.Body{
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package awsses
package aws_ses

import (
"testing"
4 changes: 2 additions & 2 deletions alerting/provider/provider.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ package provider

import (
"github.com/TwiN/gatus/v5/alerting/alert"
"github.com/TwiN/gatus/v5/alerting/provider/awsses"
"github.com/TwiN/gatus/v5/alerting/provider/aws-ses"
"github.com/TwiN/gatus/v5/alerting/provider/custom"
"github.com/TwiN/gatus/v5/alerting/provider/discord"
"github.com/TwiN/gatus/v5/alerting/provider/email"
@@ -59,7 +59,7 @@ func ParseWithDefaultAlert(providerDefaultAlert, endpointAlert *alert.Alert) {

var (
// Validate interface implementation on compile
_ AlertProvider = (*awsses.AlertProvider)(nil)
_ AlertProvider = (*aws_ses.AlertProvider)(nil)
_ AlertProvider = (*custom.AlertProvider)(nil)
_ AlertProvider = (*discord.AlertProvider)(nil)
_ AlertProvider = (*email.AlertProvider)(nil)