Skip to content

Commit

Permalink
Change ratelimit mitigation_expression to counting_expression
Browse files Browse the repository at this point in the history
This reflects a change in the public API, summarised in the following
table:

|        | counting expression             | mitigation expression             |
|--------|---------------------------------|-----------------------------------|
| before | `expression`                    | `ratelimit.mitigation_expression` |
| after  | `ratelimit.counting_expression` | `expression`                      |

In both cases, setting `ratelimit.counting_expression` or
`ratelimit.mitigation_expression` to the empty string (or not setting it
at all) signifies that it should take the same value as `expression`.
  • Loading branch information
zakcutner committed Feb 18, 2022
1 parent 1510248 commit 27afcca
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions rulesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,11 @@ type RulesetRule struct {

// RulesetRuleRateLimit contains the structure of a HTTP rate limit Ruleset Rule.
type RulesetRuleRateLimit struct {
Characteristics []string `json:"characteristics,omitempty"`
RequestsPerPeriod int `json:"requests_per_period,omitempty"`
Period int `json:"period,omitempty"`
MitigationTimeout int `json:"mitigation_timeout,omitempty"`

// Should always be sent as "" will trigger the service to use the Ruleset
// expression instead.
MitigationExpression string `json:"mitigation_expression"`
Characteristics []string `json:"characteristics,omitempty"`
RequestsPerPeriod int `json:"requests_per_period,omitempty"`
Period int `json:"period,omitempty"`
MitigationTimeout int `json:"mitigation_timeout,omitempty"`
CountingExpression string `json:"counting_expression,omitempty"`
}

// RulesetRuleExposedCredentialCheck contains the structure of an exposed
Expand Down

0 comments on commit 27afcca

Please sign in to comment.