Alerting: Remove the POST endpoint for the internal Grafana Alertmanager config (#103819)

* Remove POST config for Grafana Alertmanager

* Delete auth + test for removed path

* Alerting: Remove check for `alertingApiServer` toggle in UI (#103805)

* Remove check for alertingApiServer in UI

* Update tests to no longer care about alertingApiServer

* Add contact points handlers now that we use alertingApiServer all the time

* Fix test broken from removing camelCase for UIDs

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
This commit is contained in:
William Wernert
2025-04-11 17:38:53 -04:00
committed by GitHub
co-authored by Tom Ratcliffe
parent c47ab101d1
commit a5288db624
50 changed files with 687 additions and 1928 deletions
@@ -42,7 +42,6 @@ type AlertmanagerApi interface {
RouteGetSilences(*contextmodel.ReqContext) response.Response
RoutePostAMAlerts(*contextmodel.ReqContext) response.Response
RoutePostAlertingConfig(*contextmodel.ReqContext) response.Response
RoutePostGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response
RoutePostGrafanaAlertingConfigHistoryActivate(*contextmodel.ReqContext) response.Response
RoutePostTestGrafanaReceivers(*contextmodel.ReqContext) response.Response
RoutePostTestGrafanaTemplates(*contextmodel.ReqContext) response.Response
@@ -162,14 +161,6 @@ func (f *AlertmanagerApiHandler) RoutePostAlertingConfig(ctx *contextmodel.ReqCo
}
return f.handleRoutePostAlertingConfig(ctx, conf, datasourceUIDParam)
}
func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfig(ctx *contextmodel.ReqContext) response.Response {
// Parse Request Body
conf := apimodels.PostableUserConfig{}
if err := web.Bind(ctx.Req, &conf); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}
return f.handleRoutePostGrafanaAlertingConfig(ctx, conf)
}
func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfigHistoryActivate(ctx *contextmodel.ReqContext) response.Response {
// Parse Path Parameters
idParam := web.Params(ctx.Req)[":id"]
@@ -458,18 +449,6 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApi, m *metrics
m,
),
)
group.Post(
toMacaronPath("/api/alertmanager/grafana/config/api/v1/alerts"),
requestmeta.SetOwner(requestmeta.TeamAlerting),
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
api.authorize(http.MethodPost, "/api/alertmanager/grafana/config/api/v1/alerts"),
metrics.Instrument(
http.MethodPost,
"/api/alertmanager/grafana/config/api/v1/alerts",
api.Hooks.Wrap(srv.RoutePostGrafanaAlertingConfig),
m,
),
)
group.Post(
toMacaronPath("/api/alertmanager/grafana/config/history/{id}/_activate"),
requestmeta.SetOwner(requestmeta.TeamAlerting),