Alerting: Add endpoint to revert to a previous alertmanager configuration (#65751)

* Alerting: Add endpoint to revert to a previous alertmanager configuration

This endpoint is meant to be used in conjunction with /api/alertmanager/grafana/config/history to
revert to a previously applied alertmanager configuration. This is done by ID instead of raw config
string in order to avoid secure field complications.
This commit is contained in:
Matthew Jacobson
2023-04-05 14:10:03 -04:00
committed by GitHub
parent 6c6427e63f
commit 85f738cdf9
16 changed files with 393 additions and 9 deletions
@@ -61,6 +61,15 @@ import (
// Responses:
// 200: GettableHistoricUserConfigs
// swagger:route POST /api/alertmanager/grafana/config/history/{id}/_activate alertmanager RoutePostGrafanaAlertingConfigHistoryActivate
//
// revert Alerting configuration to the historical configuration specified by the given id
//
// Responses:
// 202: Ack
// 400: ValidationError
// 404: NotFound
// swagger:route DELETE /api/alertmanager/grafana/config/api/v1/alerts alertmanager RouteDeleteGrafanaAlertingConfig
//
// deletes the Alerting config for a tenant
@@ -458,6 +467,13 @@ type BodyAlertingConfig struct {
Body PostableUserConfig
}
// swagger:parameters RoutePostGrafanaAlertingConfigHistoryActivate
type HistoricalConfigId struct {
// Id should be the id of the GettableHistoricUserConfig
// in:path
Id int64 `json:"id"`
}
// alertmanager routes
// swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig
// testing routes