Rename max_rule_groups to max_groups

Signed-off-by: Raphael Silva <rapphil@gmail.com>
This commit is contained in:
Raphael Silva 2024-07-15 14:38:59 +00:00
parent b9c0c847f9
commit 11c20b8d4d
2 changed files with 7 additions and 7 deletions

View file

@ -1589,12 +1589,12 @@ func parseListRulesPaginationRequest(r *http.Request) (*listRulesPaginationReque
err error
)
if r.URL.Query().Get("max_rule_groups") != "" {
maxRuleGroups, err = strconv.ParseInt(r.URL.Query().Get("max_rule_groups"), 10, 32)
if r.URL.Query().Get("max_groups") != "" {
maxRuleGroups, err = strconv.ParseInt(r.URL.Query().Get("max_groups"), 10, 32)
if err != nil || maxRuleGroups < 0 {
return nil, &parsePaginationError{
err: fmt.Errorf("max_rule_groups need to be a valid number greater than or equal to 0: %w", err),
parameter: "max_rule_groups",
err: fmt.Errorf("max_groups need to be a valid number greater than or equal to 0: %w", err),
parameter: "max_groups",
}
}
}

View file

@ -2744,7 +2744,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
{
endpoint: api.rules,
query: url.Values{
"max_rule_groups": []string{"1"},
"max_groups": []string{"1"},
},
response: &RuleDiscovery{
NextToken: getRuleGroupNextToken("/path/to/file", "grp2"),
@ -2840,7 +2840,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
{
endpoint: api.rules,
query: url.Values{
"max_rule_groups": []string{"1"},
"max_groups": []string{"1"},
"next_token": []string{getRuleGroupNextToken("/path/to/file", "grp2")},
},
response: &RuleDiscovery{