Files
grafana/pkg/services/ngalert/api/generated_base_api_history.go
T
Grot (@grafanabot) 2525b30803 [v9.4.x] Alerting: Add endpoint for querying state history (#62813)
Alerting: Add endpoint for querying state history (#62166)

* Define endpoint and generate

* Wire up and register endpoint

* Cleanup, define authorization

* Forgot the leading slash

* Wire up query and SignedInUser

* Wire up timerange query params

* Add todo for label queries

* Drop comment

* Update path to rules subtree

(cherry picked from commit 6ad1cfef38)

Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
2023-02-02 12:32:30 -06:00

41 lines
1.2 KiB
Go

/*Package api contains base API implementation of unified alerting
*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.
*/
package api
import (
"net/http"
"github.com/grafana/grafana/pkg/api/response"
"github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/middleware"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
)
type HistoryApi interface {
RouteGetStateHistory(*contextmodel.ReqContext) response.Response
}
func (f *HistoryApiHandler) RouteGetStateHistory(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetStateHistory(ctx)
}
func (api *API) RegisterHistoryApiEndpoints(srv HistoryApi, m *metrics.API) {
api.RouteRegister.Group("", func(group routing.RouteRegister) {
group.Get(
toMacaronPath("/api/v1/rules/history"),
api.authorize(http.MethodGet, "/api/v1/rules/history"),
metrics.Instrument(
http.MethodGet,
"/api/v1/rules/history",
srv.RouteGetStateHistory,
m,
),
)
}, middleware.ReqSignedIn)
}