mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
e097ffc771
* update grafana/alerting to latest main * update alertmanager to 66ec17e3aa45
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package notifier
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/alerting/receivers"
|
|
|
|
"github.com/grafana/grafana/pkg/services/notifications"
|
|
)
|
|
|
|
type sender struct {
|
|
ns notifications.Service
|
|
}
|
|
|
|
func (s sender) SendWebhook(ctx context.Context, cmd *receivers.SendWebhookSettings) error {
|
|
return s.ns.SendWebhookSync(ctx, ¬ifications.SendWebhookSync{
|
|
Url: cmd.URL,
|
|
User: cmd.User,
|
|
Password: cmd.Password,
|
|
Body: cmd.Body,
|
|
HttpMethod: cmd.HTTPMethod,
|
|
HttpHeader: cmd.HTTPHeader,
|
|
ContentType: cmd.ContentType,
|
|
Validation: cmd.Validation,
|
|
})
|
|
}
|
|
|
|
func (s sender) SendEmail(ctx context.Context, cmd *receivers.SendEmailSettings) error {
|
|
return s.ns.SendEmailCommandHandlerSync(ctx, ¬ifications.SendEmailCommandSync{
|
|
SendEmailCommand: notifications.SendEmailCommand{
|
|
To: cmd.To,
|
|
SingleEmail: cmd.SingleEmail,
|
|
Template: cmd.Template,
|
|
Subject: cmd.Subject,
|
|
Data: cmd.Data,
|
|
ReplyTo: cmd.ReplyTo,
|
|
EmbeddedFiles: cmd.EmbeddedFiles,
|
|
},
|
|
})
|
|
}
|