Skip to content

Commit

Permalink
Rename max_rule_groups to max_groups
Browse files Browse the repository at this point in the history
Signed-off-by: Raphael Silva <[email protected]>
  • Loading branch information
rapphil committed Jul 15, 2024
1 parent b9c0c84 commit 11c20b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions web/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions web/api/v1/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -2840,8 +2840,8 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
{
endpoint: api.rules,
query: url.Values{
"max_rule_groups": []string{"1"},
"next_token": []string{getRuleGroupNextToken("/path/to/file", "grp2")},
"max_groups": []string{"1"},
"next_token": []string{getRuleGroupNextToken("/path/to/file", "grp2")},
},
response: &RuleDiscovery{
RuleGroups: []*RuleGroup{
Expand Down

0 comments on commit 11c20b8

Please sign in to comment.