From 427dfaf8943d1f5432bd39d86d88487305ffabb3 Mon Sep 17 00:00:00 2001 From: Vincent Roy Date: Fri, 3 May 2024 15:10:24 -0300 Subject: [PATCH] fix: add Position to RulesetRule This will allow to update position of a specific rule in PATCH: * fixes: https://github.com/cloudflare/cloudflare-go/issues/1938 * https://developers.cloudflare.com/ruleset-engine/rulesets-api/update-rule/#change-the-order-of-a-rule-in-a-ruleset --- rulesets.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rulesets.go b/rulesets.go index c8a476251a7..f03536e16ff 100644 --- a/rulesets.go +++ b/rulesets.go @@ -660,6 +660,7 @@ type RulesetRule struct { RateLimit *RulesetRuleRateLimit `json:"ratelimit,omitempty"` ExposedCredentialCheck *RulesetRuleExposedCredentialCheck `json:"exposed_credential_check,omitempty"` Logging *RulesetRuleLogging `json:"logging,omitempty"` + Position *RulesetRulePosition `json:"position,omitempty"` } // RulesetRuleRateLimit contains the structure of a HTTP rate limit Ruleset Rule. @@ -674,6 +675,13 @@ type RulesetRuleRateLimit struct { RequestsToOrigin bool `json:"requests_to_origin,omitempty"` } +// RulesetRulePositon contains the structure of a Ruleset Rule position. +type RulesetRulePosition struct { + Index int `json:"index,omitempty"` + Before string `json:"before,omitempty"` + After string `json:"after,omitempty"` +} + // RulesetRuleExposedCredentialCheck contains the structure of an exposed // credential check Ruleset Rule. type RulesetRuleExposedCredentialCheck struct {