2021-04-09 04:55:41 -05:00
|
|
|
/*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 (
|
2021-04-28 15:59:15 -05:00
|
|
|
"net/http"
|
|
|
|
|
2021-04-09 04:55:41 -05:00
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
|
|
"github.com/grafana/grafana/pkg/api/routing"
|
2022-03-24 16:13:47 -05:00
|
|
|
"github.com/grafana/grafana/pkg/middleware"
|
2023-08-29 05:43:33 -05:00
|
|
|
"github.com/grafana/grafana/pkg/middleware/requestmeta"
|
2023-01-27 01:50:36 -06:00
|
|
|
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
2021-04-19 13:26:04 -05:00
|
|
|
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
2021-04-30 11:28:06 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
2021-12-13 02:22:57 -06:00
|
|
|
"github.com/grafana/grafana/pkg/web"
|
2021-04-09 04:55:41 -05:00
|
|
|
)
|
|
|
|
|
2022-07-18 02:08:08 -05:00
|
|
|
type RulerApi interface {
|
2023-01-27 01:50:36 -06:00
|
|
|
RouteDeleteGrafanaRuleGroupConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteDeleteNamespaceGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteDeleteNamespaceRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteDeleteRuleGroupConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetGrafanaRuleGroupConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetNamespaceGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetNamespaceRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetRulegGroupConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RouteGetRulesConfig(*contextmodel.ReqContext) response.Response
|
2023-10-02 10:47:59 -05:00
|
|
|
RouteGetRulesForExport(*contextmodel.ReqContext) response.Response
|
2023-01-27 01:50:36 -06:00
|
|
|
RoutePostNameGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
|
|
|
|
RoutePostNameRulesConfig(*contextmodel.ReqContext) response.Response
|
2023-10-02 10:47:59 -05:00
|
|
|
RoutePostRulesGroupForExport(*contextmodel.ReqContext) response.Response
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
|
|
|
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteDeleteGrafanaRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
|
|
|
groupnameParam := web.Params(ctx.Req)[":Groupname"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteDeleteGrafanaRuleGroupConfig(ctx, namespaceParam, groupnameParam)
|
2022-02-04 11:42:04 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteDeleteNamespaceGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteDeleteNamespaceGrafanaRulesConfig(ctx, namespaceParam)
|
2021-04-09 04:55:41 -05:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteDeleteNamespaceRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteDeleteNamespaceRulesConfig(ctx, datasourceUIDParam, namespaceParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteDeleteRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
|
|
|
groupnameParam := web.Params(ctx.Req)[":Groupname"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteDeleteRuleGroupConfig(ctx, datasourceUIDParam, namespaceParam, groupnameParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetGrafanaRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
|
|
|
groupnameParam := web.Params(ctx.Req)[":Groupname"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetGrafanaRuleGroupConfig(ctx, namespaceParam, groupnameParam)
|
2022-02-04 11:42:04 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetGrafanaRulesConfig(ctx)
|
2022-02-04 11:42:04 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetNamespaceGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetNamespaceGrafanaRulesConfig(ctx, namespaceParam)
|
2022-02-04 11:42:04 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetNamespaceRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetNamespaceRulesConfig(ctx, datasourceUIDParam, namespaceParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetRulegGroupConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
|
|
|
groupnameParam := web.Params(ctx.Req)[":Groupname"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetRulegGroupConfig(ctx, datasourceUIDParam, namespaceParam, groupnameParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RouteGetRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRouteGetRulesConfig(ctx, datasourceUIDParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-10-02 10:47:59 -05:00
|
|
|
func (f *RulerApiHandler) RouteGetRulesForExport(ctx *contextmodel.ReqContext) response.Response {
|
|
|
|
return f.handleRouteGetRulesForExport(ctx)
|
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RoutePostNameGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Request Body
|
2022-02-04 11:42:04 -06:00
|
|
|
conf := apimodels.PostableRuleGroupConfig{}
|
|
|
|
if err := web.Bind(ctx.Req, &conf); err != nil {
|
|
|
|
return response.Error(http.StatusBadRequest, "bad request data", err)
|
|
|
|
}
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRoutePostNameGrafanaRulesConfig(ctx, conf, namespaceParam)
|
2022-02-04 11:42:04 -06:00
|
|
|
}
|
2023-01-27 01:50:36 -06:00
|
|
|
func (f *RulerApiHandler) RoutePostNameRulesConfig(ctx *contextmodel.ReqContext) response.Response {
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Path Parameters
|
2022-06-23 15:13:39 -05:00
|
|
|
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
2022-07-18 02:08:08 -05:00
|
|
|
// Parse Request Body
|
2021-12-13 02:22:57 -06:00
|
|
|
conf := apimodels.PostableRuleGroupConfig{}
|
|
|
|
if err := web.Bind(ctx.Req, &conf); err != nil {
|
|
|
|
return response.Error(http.StatusBadRequest, "bad request data", err)
|
|
|
|
}
|
2022-07-18 02:08:08 -05:00
|
|
|
return f.handleRoutePostNameRulesConfig(ctx, conf, datasourceUIDParam, namespaceParam)
|
2021-12-13 02:22:57 -06:00
|
|
|
}
|
2023-10-02 10:47:59 -05:00
|
|
|
func (f *RulerApiHandler) RoutePostRulesGroupForExport(ctx *contextmodel.ReqContext) response.Response {
|
|
|
|
// Parse Path Parameters
|
|
|
|
namespaceParam := web.Params(ctx.Req)[":Namespace"]
|
|
|
|
// Parse Request Body
|
|
|
|
conf := apimodels.PostableRuleGroupConfig{}
|
|
|
|
if err := web.Bind(ctx.Req, &conf); err != nil {
|
|
|
|
return response.Error(http.StatusBadRequest, "bad request data", err)
|
|
|
|
}
|
|
|
|
return f.handleRoutePostRulesGroupForExport(ctx, conf, namespaceParam)
|
|
|
|
}
|
2021-12-13 02:22:57 -06:00
|
|
|
|
2022-07-18 02:08:08 -05:00
|
|
|
func (api *API) RegisterRulerApiEndpoints(srv RulerApi, m *metrics.API) {
|
2021-04-09 04:55:41 -05:00
|
|
|
api.RouteRegister.Group("", func(group routing.RouteRegister) {
|
2022-02-04 11:42:04 -06:00
|
|
|
group.Delete(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodDelete, "/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodDelete,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteDeleteGrafanaRuleGroupConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Delete(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodDelete, "/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodDelete,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteDeleteNamespaceGrafanaRulesConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
2021-04-28 15:59:15 -05:00
|
|
|
group.Delete(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodDelete, "/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodDelete,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteDeleteNamespaceRulesConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Delete(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodDelete, "/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodDelete,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteDeleteRuleGroupConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
2022-02-04 11:42:04 -06:00
|
|
|
group.Get(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodGet,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetGrafanaRuleGroupConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Get(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/grafana/api/v1/rules"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodGet,
|
|
|
|
"/api/ruler/grafana/api/v1/rules",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetGrafanaRulesConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Get(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodGet,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetNamespaceGrafanaRulesConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
2021-04-28 15:59:15 -05:00
|
|
|
group.Get(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodGet,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetNamespaceRulesConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Get(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodGet,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetRulegGroupConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
|
|
|
group.Get(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodGet, "/api/ruler/{DatasourceUID}/api/v1/rules"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodGet,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RouteGetRulesConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
2023-10-02 10:47:59 -05:00
|
|
|
group.Get(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/export/rules"),
|
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
|
|
|
api.authorize(http.MethodGet, "/api/ruler/grafana/api/v1/export/rules"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodGet,
|
|
|
|
"/api/ruler/grafana/api/v1/export/rules",
|
|
|
|
api.Hooks.Wrap(srv.RouteGetRulesForExport),
|
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
2022-02-04 11:42:04 -06:00
|
|
|
group.Post(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-02-04 11:42:04 -06:00
|
|
|
api.authorize(http.MethodPost, "/api/ruler/grafana/api/v1/rules/{Namespace}"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodPost,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RoutePostNameGrafanaRulesConfig),
|
2022-02-04 11:42:04 -06:00
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
2021-04-28 15:59:15 -05:00
|
|
|
group.Post(
|
2022-05-05 06:58:32 -05:00
|
|
|
toMacaronPath("/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2023-08-29 05:43:33 -05:00
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
2023-09-29 07:56:48 -05:00
|
|
|
requestmeta.SetSLOGroup(requestmeta.SLOGroupHighSlow),
|
2022-05-05 06:58:32 -05:00
|
|
|
api.authorize(http.MethodPost, "/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}"),
|
2021-04-30 11:28:06 -05:00
|
|
|
metrics.Instrument(
|
2021-04-28 15:59:15 -05:00
|
|
|
http.MethodPost,
|
2022-05-05 06:58:32 -05:00
|
|
|
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}",
|
2023-04-24 11:18:44 -05:00
|
|
|
api.Hooks.Wrap(srv.RoutePostNameRulesConfig),
|
2021-04-30 11:28:06 -05:00
|
|
|
m,
|
2021-04-28 15:59:15 -05:00
|
|
|
),
|
|
|
|
)
|
2023-10-02 10:47:59 -05:00
|
|
|
group.Post(
|
|
|
|
toMacaronPath("/api/ruler/grafana/api/v1/rules/{Namespace}/export"),
|
|
|
|
requestmeta.SetOwner(requestmeta.TeamAlerting),
|
|
|
|
api.authorize(http.MethodPost, "/api/ruler/grafana/api/v1/rules/{Namespace}/export"),
|
|
|
|
metrics.Instrument(
|
|
|
|
http.MethodPost,
|
|
|
|
"/api/ruler/grafana/api/v1/rules/{Namespace}/export",
|
|
|
|
api.Hooks.Wrap(srv.RoutePostRulesGroupForExport),
|
|
|
|
m,
|
|
|
|
),
|
|
|
|
)
|
2022-03-24 16:13:47 -05:00
|
|
|
}, middleware.ReqSignedIn)
|
2021-04-09 04:55:41 -05:00
|
|
|
}
|