grafana/pkg/services/ngalert/api/configuration.go
Yuriy Tseretyan 8a62020211
Alerting: New API endpoint GET /api/v1/ngalert (#55134)
* declare new endpoint /api/v1/ngalert
* add authorization for new path
* add request handler for the new path
2022-09-14 14:03:10 -04:00

39 lines
1.2 KiB
Go

package api
import (
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/models"
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
)
// ConfigurationApiHandler always forwards requests to grafana backend
type ConfigurationApiHandler struct {
grafana *ConfigSrv
}
func NewConfiguration(grafana *ConfigSrv) *ConfigurationApiHandler {
return &ConfigurationApiHandler{
grafana: grafana,
}
}
func (f *ConfigurationApiHandler) handleRouteGetAlertmanagers(c *models.ReqContext) response.Response {
return f.grafana.RouteGetAlertmanagers(c)
}
func (f *ConfigurationApiHandler) handleRouteGetNGalertConfig(c *models.ReqContext) response.Response {
return f.grafana.RouteGetNGalertConfig(c)
}
func (f *ConfigurationApiHandler) handleRoutePostNGalertConfig(c *models.ReqContext, body apimodels.PostableNGalertConfig) response.Response {
return f.grafana.RoutePostNGalertConfig(c, body)
}
func (f *ConfigurationApiHandler) handleRouteDeleteNGalertConfig(c *models.ReqContext) response.Response {
return f.grafana.RouteDeleteNGalertConfig(c)
}
func (f *ConfigurationApiHandler) handleRouteGetStatus(c *models.ReqContext) response.Response {
return f.grafana.RouteGetAlertingStatus(c)
}