grafana/pkg/services/ngalert/api/notifications.go
William Wernert 2ab7d3c725
Alerting: Receivers API (read only endpoints) (#81751)
* Add single receiver method

* Add receiver permissions

* Add single/multi GET endpoints for receivers

* Remove stable tag from time intervals

See end of PR description here: https://github.com/grafana/grafana/pull/81672
2024-02-05 20:12:15 +02:00

33 lines
1.1 KiB
Go

package api
import (
"github.com/grafana/grafana/pkg/api/response"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
)
type NotificationsApiHandler struct {
notificationSrv *NotificationSrv
}
func NewNotificationsApi(notificationSrv *NotificationSrv) *NotificationsApiHandler {
return &NotificationsApiHandler{
notificationSrv: notificationSrv,
}
}
func (f *NotificationsApiHandler) handleRouteNotificationsGetTimeInterval(ctx *contextmodel.ReqContext, name string) response.Response {
return f.notificationSrv.RouteGetTimeInterval(ctx, name)
}
func (f *NotificationsApiHandler) handleRouteNotificationsGetTimeIntervals(ctx *contextmodel.ReqContext) response.Response {
return f.notificationSrv.RouteGetTimeIntervals(ctx)
}
func (f *NotificationsApiHandler) handleRouteGetReceiver(ctx *contextmodel.ReqContext, name string) response.Response {
return f.notificationSrv.RouteGetReceiver(ctx, name)
}
func (f *NotificationsApiHandler) handleRouteGetReceivers(ctx *contextmodel.ReqContext) response.Response {
return f.notificationSrv.RouteGetReceivers(ctx)
}