2021-03-12 03:28:00 +08:00
|
|
|
/*Package api contains base API implementation of unified alerting
|
|
|
|
|
*
|
2021-04-09 17:55:41 +08:00
|
|
|
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
2021-03-12 03:28:00 +08:00
|
|
|
*
|
2021-04-09 17:55:41 +08:00
|
|
|
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.
|
2021-03-12 03:28:00 +08:00
|
|
|
*/
|
2021-04-21 01:12:32 +08:00
|
|
|
|
2021-03-12 03:28:00 +08:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/go-macaron/binding"
|
2021-04-09 17:55:41 +08:00
|
|
|
|
2021-03-12 03:28:00 +08:00
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
|
|
|
"github.com/grafana/grafana/pkg/api/routing"
|
2021-04-06 22:22:05 +08:00
|
|
|
"github.com/grafana/grafana/pkg/middleware"
|
2021-03-12 03:28:00 +08:00
|
|
|
"github.com/grafana/grafana/pkg/models"
|
2021-04-20 02:26:04 +08:00
|
|
|
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
2021-03-12 03:28:00 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type TestingApiService interface {
|
2021-04-22 03:44:50 +08:00
|
|
|
RouteEvalQueries(*models.ReqContext, apimodels.EvalQueriesPayload) response.Response
|
2021-03-12 03:28:00 +08:00
|
|
|
RouteTestReceiverConfig(*models.ReqContext, apimodels.ExtendedReceiver) response.Response
|
|
|
|
|
RouteTestRuleConfig(*models.ReqContext, apimodels.TestRulePayload) response.Response
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (api *API) RegisterTestingApiEndpoints(srv TestingApiService) {
|
|
|
|
|
api.RouteRegister.Group("", func(group routing.RouteRegister) {
|
2021-04-22 03:44:50 +08:00
|
|
|
group.Post(toMacaronPath("/api/v1/eval"), binding.Bind(apimodels.EvalQueriesPayload{}), routing.Wrap(srv.RouteEvalQueries))
|
2021-04-14 01:58:34 +08:00
|
|
|
group.Post(toMacaronPath("/api/v1/receiver/test/{Recipient}"), binding.Bind(apimodels.ExtendedReceiver{}), routing.Wrap(srv.RouteTestReceiverConfig))
|
|
|
|
|
group.Post(toMacaronPath("/api/v1/rule/test/{Recipient}"), binding.Bind(apimodels.TestRulePayload{}), routing.Wrap(srv.RouteTestRuleConfig))
|
2021-04-06 22:22:05 +08:00
|
|
|
}, middleware.ReqSignedIn)
|
2021-03-12 03:28:00 +08:00
|
|
|
}
|