mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: add route owner middleware (#73869)
alerting: add route owner middleware Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/middleware/requestmeta"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
||||
@@ -64,6 +65,7 @@ func (api *API) RegisterTestingApiEndpoints(srv TestingApi, m *metrics.API) {
|
||||
api.RouteRegister.Group("", func(group routing.RouteRegister) {
|
||||
group.Post(
|
||||
toMacaronPath("/api/v1/rule/backtest"),
|
||||
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
||||
api.authorize(http.MethodPost, "/api/v1/rule/backtest"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
@@ -74,6 +76,7 @@ func (api *API) RegisterTestingApiEndpoints(srv TestingApi, m *metrics.API) {
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/v1/eval"),
|
||||
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
||||
api.authorize(http.MethodPost, "/api/v1/eval"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
@@ -84,6 +87,7 @@ func (api *API) RegisterTestingApiEndpoints(srv TestingApi, m *metrics.API) {
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/v1/rule/test/{DatasourceUID}"),
|
||||
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
||||
api.authorize(http.MethodPost, "/api/v1/rule/test/{DatasourceUID}"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
@@ -94,6 +98,7 @@ func (api *API) RegisterTestingApiEndpoints(srv TestingApi, m *metrics.API) {
|
||||
)
|
||||
group.Post(
|
||||
toMacaronPath("/api/v1/rule/test/grafana"),
|
||||
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
||||
api.authorize(http.MethodPost, "/api/v1/rule/test/grafana"),
|
||||
metrics.Instrument(
|
||||
http.MethodPost,
|
||||
|
||||
Reference in New Issue
Block a user