feat(notifications): make it possible to send test alert notifications

closes #5847
This commit is contained in:
bergquist
2016-09-05 14:45:15 +02:00
parent 4c5461d4ba
commit d11bc57c37
7 changed files with 163 additions and 3 deletions
+16
View File
@@ -214,6 +214,22 @@ func DeleteAlertNotification(c *middleware.Context) Response {
return ApiSuccess("Notification deleted")
}
//POST /api/alert-notifications/test
func NotificationTest(c *middleware.Context, dto dtos.NotificationTestCommand) Response {
cmd := &alerting.NotificationTestCommand{
Name: dto.Name,
Type: dto.Type,
Severity: dto.Severity,
Settings: dto.Settings,
}
if err := bus.Dispatch(cmd); err != nil {
return ApiError(500, "Failed to send alert notifications", err)
}
return ApiSuccess("Test notification sent")
}
func GetAlertHistory(c *middleware.Context) Response {
alertId, err := getAlertIdForRequest(c)
if err != nil {