(req *http.Request)
| 281 | } |
| 282 | |
| 283 | func parseListRulesPaginationRequest(req *http.Request) (listRulesPaginationRequest, error) { |
| 284 | var ( |
| 285 | returnMaxRuleGroups = int32(-1) |
| 286 | ) |
| 287 | |
| 288 | maxGroups := req.URL.Query().Get("group_limit") |
| 289 | nextToken := req.URL.Query().Get("group_next_token") |
| 290 | |
| 291 | if nextToken != "" && maxGroups == "" { |
| 292 | return listRulesPaginationRequest{ |
| 293 | MaxRuleGroups: -1, |
| 294 | NextToken: "", |
| 295 | }, errors.New("group_limit needs to be present in order to paginate over the groups") |
| 296 | } |
| 297 | |
| 298 | if maxGroups != "" { |
| 299 | parsedMaxGroups, err := strconv.ParseInt(maxGroups, 10, 32) |
| 300 | if err != nil { |
| 301 | return listRulesPaginationRequest{ |
| 302 | MaxRuleGroups: -1, |
| 303 | NextToken: "", |
| 304 | }, errors.New("group_limit needs to be a valid number") |
| 305 | } |
| 306 | if parsedMaxGroups <= 0 { |
| 307 | return listRulesPaginationRequest{ |
| 308 | MaxRuleGroups: -1, |
| 309 | NextToken: "", |
| 310 | }, errors.New("group_limit needs to be greater than 0") |
| 311 | } |
| 312 | returnMaxRuleGroups = int32(parsedMaxGroups) |
| 313 | } |
| 314 | |
| 315 | return listRulesPaginationRequest{ |
| 316 | MaxRuleGroups: returnMaxRuleGroups, |
| 317 | NextToken: nextToken, |
| 318 | }, nil |
| 319 | } |
| 320 | |
| 321 | func parseExcludeAlerts(r *http.Request) (bool, error) { |
| 322 | excludeAlertsParam := strings.ToLower(r.URL.Query().Get("exclude_alerts")) |
no test coverage detected