Alerting: Fix "Not Implemented" responses (#57710)

* fix swagger spec, return 404 instead of 501 when an endpoint does not exist

* update number of paths in authorization_test.go
This commit is contained in:
Santiago
2022-10-26 23:35:52 -03:00
committed by GitHub
parent 0a4121cef8
commit cdb5d4230a
11 changed files with 10 additions and 302 deletions
@@ -131,15 +131,6 @@ func (f *AlertmanagerApiHandler) handleRoutePostAMAlerts(ctx *models.ReqContext,
return s.RoutePostAMAlerts(ctx, body)
}
func (f *AlertmanagerApiHandler) handleRoutePostTestReceivers(ctx *models.ReqContext, body apimodels.TestReceiversConfigBodyParams, dsUID string) response.Response {
s, err := f.getService(ctx)
if err != nil {
return errorToResponse(err)
}
return s.RoutePostTestReceivers(ctx, body)
}
func (f *AlertmanagerApiHandler) handleRouteDeleteGrafanaSilence(ctx *models.ReqContext, id string) response.Response {
return f.GrafanaSvc.RouteDeleteSilence(ctx, id)
}
@@ -176,10 +167,6 @@ func (f *AlertmanagerApiHandler) handleRouteGetGrafanaSilences(ctx *models.ReqCo
return f.GrafanaSvc.RouteGetSilences(ctx)
}
func (f *AlertmanagerApiHandler) handleRoutePostGrafanaAMAlerts(ctx *models.ReqContext, conf apimodels.PostableAlerts) response.Response {
return f.GrafanaSvc.RoutePostAMAlerts(ctx, conf)
}
func (f *AlertmanagerApiHandler) handleRoutePostGrafanaAlertingConfig(ctx *models.ReqContext, conf apimodels.PostableUserConfig) response.Response {
if !conf.AlertmanagerConfig.ReceiverType().Can(apimodels.GrafanaReceiverType) {
return errorToResponse(backendTypeDoesNotMatchPayloadTypeError(apimodels.GrafanaBackend, conf.AlertmanagerConfig.ReceiverType().String()))