From 27afcca6de3352a8e208deafdb6285b64141f63b Mon Sep 17 00:00:00 2001 From: Zak Cutner Date: Tue, 15 Feb 2022 16:26:09 +0000 Subject: [PATCH] Change ratelimit `mitigation_expression` to `counting_expression` 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`. --- rulesets.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/rulesets.go b/rulesets.go index bf7291e25d..dfd5950e57 100644 --- a/rulesets.go +++ b/rulesets.go @@ -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