mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 12:14:08 -06:00
8a62020211
* declare new endpoint /api/v1/ngalert * add authorization for new path * add request handler for the new path
39 lines
1.2 KiB
Go
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)
|
|
}
|