make the responses of listing alerts apis consistent

Signed-off-by: junotx <junotx@126.com>
This commit is contained in:
junotx
2021-01-21 11:03:51 +08:00
parent 626c30b9ab
commit 5467b2a1a3
2 changed files with 15 additions and 9 deletions

View File

@@ -78,7 +78,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
ws.Route(ws.GET("/rules/{rule_name}/alerts").
To(handler.handleListCustomRuleAlerts).
Doc("list the alerts of the cluster-level custom alerting rule with the specified name").
Returns(http.StatusOK, ksapi.StatusOK, []alertingv2alpha1.Alert{}).
Returns(http.StatusOK, ksapi.StatusOK, alertingv2alpha1.AlertList{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AlertingTag}))
ws.Route(ws.POST("/rules").
@@ -134,7 +134,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
ws.Route(ws.GET("/namespaces/{namespace}/rules/{rule_name}/alerts").
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, []alertingv2alpha1.Alert{}).
Returns(http.StatusOK, ksapi.StatusOK, alertingv2alpha1.AlertList{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AlertingTag}))
ws.Route(ws.POST("/namespaces/{namespace}/rules").
@@ -190,7 +190,7 @@ func AddToContainer(container *restful.Container, informers informers.InformerFa
ws.Route(ws.GET("/builtin/rules/{rule_id}/alerts").
To(handler.handleListBuiltinRuleAlerts).
Doc("list the alerts of the builtin(non-custom) alerting rule with the specified id").
Returns(http.StatusOK, ksapi.StatusOK, []alertingv2alpha1.Alert{}).
Returns(http.StatusOK, ksapi.StatusOK, alertingv2alpha1.AlertList{}).
Metadata(restfulspec.KeyOpenAPITags, []string{constants.AlertingTag}))
container.Add(ws)