Chore: replace macaron with web package (#40136)
* replace macaron with web package * add web.go
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"net/url"
|
||||
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"gopkg.in/macaron.v1"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
@@ -42,7 +42,7 @@ func (r *LotexRuler) RouteDeleteNamespaceRulesConfig(ctx *models.ReqContext) res
|
||||
http.MethodDelete,
|
||||
withPath(
|
||||
*ctx.Req.URL,
|
||||
fmt.Sprintf("%s/%s", legacyRulerPrefix, macaron.Params(ctx.Req)[":Namespace"]),
|
||||
fmt.Sprintf("%s/%s", legacyRulerPrefix, web.Params(ctx.Req)[":Namespace"]),
|
||||
),
|
||||
nil,
|
||||
messageExtractor,
|
||||
@@ -63,8 +63,8 @@ func (r *LotexRuler) RouteDeleteRuleGroupConfig(ctx *models.ReqContext) response
|
||||
fmt.Sprintf(
|
||||
"%s/%s/%s",
|
||||
legacyRulerPrefix,
|
||||
macaron.Params(ctx.Req)[":Namespace"],
|
||||
macaron.Params(ctx.Req)[":Groupname"],
|
||||
web.Params(ctx.Req)[":Namespace"],
|
||||
web.Params(ctx.Req)[":Groupname"],
|
||||
),
|
||||
),
|
||||
nil,
|
||||
@@ -86,7 +86,7 @@ func (r *LotexRuler) RouteGetNamespaceRulesConfig(ctx *models.ReqContext) respon
|
||||
fmt.Sprintf(
|
||||
"%s/%s",
|
||||
legacyRulerPrefix,
|
||||
macaron.Params(ctx.Req)[":Namespace"],
|
||||
web.Params(ctx.Req)[":Namespace"],
|
||||
),
|
||||
),
|
||||
nil,
|
||||
@@ -108,8 +108,8 @@ func (r *LotexRuler) RouteGetRulegGroupConfig(ctx *models.ReqContext) response.R
|
||||
fmt.Sprintf(
|
||||
"%s/%s/%s",
|
||||
legacyRulerPrefix,
|
||||
macaron.Params(ctx.Req)[":Namespace"],
|
||||
macaron.Params(ctx.Req)[":Groupname"],
|
||||
web.Params(ctx.Req)[":Namespace"],
|
||||
web.Params(ctx.Req)[":Groupname"],
|
||||
),
|
||||
),
|
||||
nil,
|
||||
@@ -145,7 +145,7 @@ func (r *LotexRuler) RoutePostNameRulesConfig(ctx *models.ReqContext, conf apimo
|
||||
if err != nil {
|
||||
return ErrResp(500, err, "Failed marshal rule group")
|
||||
}
|
||||
ns := macaron.Params(ctx.Req)[":Namespace"]
|
||||
ns := web.Params(ctx.Req)[":Namespace"]
|
||||
u := withPath(*ctx.Req.URL, fmt.Sprintf("%s/%s", legacyRulerPrefix, ns))
|
||||
return r.withReq(ctx, http.MethodPost, u, bytes.NewBuffer(yml), jsonExtractor(nil), nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user