@@ -110,11 +110,11 @@ func (h *handler) handleGetCustomAlertingRule(req *restful.Request, resp *restfu
|
||||
resp.WriteEntity(rule)
|
||||
}
|
||||
|
||||
func (h *handler) handleListCustomSpecifiedRuleAlerts(req *restful.Request, resp *restful.Response) {
|
||||
func (h *handler) handleListCustomRuleAlerts(req *restful.Request, resp *restful.Response) {
|
||||
namespace := req.PathParameter("namespace")
|
||||
ruleName := req.PathParameter("rule_name")
|
||||
|
||||
alerts, err := h.operator.ListCustomSpecifiedRuleAlerts(req.Request.Context(), namespace, ruleName)
|
||||
alerts, err := h.operator.ListCustomRuleAlerts(req.Request.Context(), namespace, ruleName)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
switch {
|
||||
@@ -266,10 +266,10 @@ func (h *handler) handleGetBuiltinAlertingRule(req *restful.Request, resp *restf
|
||||
resp.WriteEntity(rule)
|
||||
}
|
||||
|
||||
func (h *handler) handleListBuiltinSpecifiedRuleAlerts(req *restful.Request, resp *restful.Response) {
|
||||
func (h *handler) handleListBuiltinRuleAlerts(req *restful.Request, resp *restful.Response) {
|
||||
ruleId := req.PathParameter("rule_id")
|
||||
|
||||
alerts, err := h.operator.ListBuiltinSpecifiedRuleAlerts(req.Request.Context(), ruleId)
|
||||
alerts, err := h.operator.ListBuiltinRuleAlerts(req.Request.Context(), ruleId)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
switch {
|
||||
|
||||
@@ -76,7 +76,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
|
||||
ws.Route(ws.GET("/rules/{rule_name}/alerts").
|
||||
To(handler.handleListCustomSpecifiedRuleAlerts).
|
||||
To(handler.handleListCustomRuleAlerts).
|
||||
Doc("list the alerts of the cluster-level custom alerting rule with the specified name").
|
||||
Returns(http.StatusOK, ksapi.StatusOK, []customalertingv1alpha1.Alert{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
@@ -132,7 +132,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
|
||||
ws.Route(ws.GET("/namespaces/{namespace}/rules/{rule_name}/alerts").
|
||||
To(handler.handleListCustomSpecifiedRuleAlerts).
|
||||
To(handler.handleListCustomRuleAlerts).
|
||||
Doc("get the alerts of the custom alerting rule with the specified name in the specified namespace").
|
||||
Returns(http.StatusOK, ksapi.StatusOK, []customalertingv1alpha1.Alert{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
@@ -188,7 +188,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
|
||||
ws.Route(ws.GET("/builtin/rules/{rule_id}/alerts").
|
||||
To(handler.handleListBuiltinSpecifiedRuleAlerts).
|
||||
To(handler.handleListBuiltinRuleAlerts).
|
||||
Doc("list the alerts of the builtin(non-custom) alerting rule with the specified id").
|
||||
Returns(http.StatusOK, ksapi.StatusOK, []customalertingv1alpha1.Alert{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.CustomAlertingTag}))
|
||||
|
||||
Reference in New Issue
Block a user