Skip to content
Start here

Update an account or zone ruleset rule

client.Rulesets.Rules.Edit(ctx, rulesetID, ruleID, params) (*RuleEditResponseUnion, error)
PATCH/{accounts_or_zones}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}

Updates an existing rule in an account or zone ruleset.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Mass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteTransform Rules WriteSelect Configuration WriteAccount WAF WriteAccount Rulesets WriteLogs Write
ParametersExpand Collapse
rulesetID string

The unique ID of the ruleset.

ruleID string

The unique ID of the rule.

params RuleEditParams
AccountID param.Field[string]Optional

Path param: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

ZoneID param.Field[string]Optional

Path param: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

DryRun param.Field[bool]Optional

Query param: Validates the request without persisting changes when set to true. Responses that normally return 200 return result: null; endpoints that normally return 204 continue to return 204.

ID param.Field[string]Optional

Body param: The unique ID of the rule.

Action param.Field[RuleEditParamsBlockRuleAction]Optional

Body param: The action to perform when the rule matches.

const RuleEditParamsBlockRuleActionBlock RuleEditParamsBlockRuleAction = "block"
ActionParameters param.Field[RuleEditParamsBlockRuleActionParameters]Optional

Body param: The parameters configuring the rule’s action.

Response RuleEditParamsBlockRuleActionParametersResponseOptional

The response to show when the block is applied.

Content string

The content to return.

minLength1
ContentType string

The type of the content to return.

minLength1
StatusCode int64

The status code to return.

maximum499
minimum400
Description param.Field[string]Optional

Body param: An informative description of the rule.

Enabled param.Field[bool]Optional

Body param: Whether the rule should be executed.

ExposedCredentialCheck param.Field[RuleEditParamsBlockRuleExposedCredentialCheck]Optional

Body param: Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Expression param.Field[string]Optional

Body param: The expression defining which traffic will match the rule.

minLength1
Logging param.Field[Logging]Optional

Body param: An object configuring the rule’s logging behavior.

Position param.Field[RuleEditParamsBlockRulePosition]Optional

Body param: An object configuring where the rule will be placed.

RuleEditParamsBlockRulePositionBeforePosition
Before stringOptional

The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.

RuleEditParamsBlockRulePositionAfterPosition
After stringOptional

The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.

RuleEditParamsBlockRulePositionIndexPosition
Index int64Optional

An index at which to place the rule, where index 1 is the first rule.

minimum1
Ratelimit param.Field[RuleEditParamsBlockRuleRatelimit]Optional

Body param: An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
Ref param.Field[string]Optional

Body param: The reference of the rule (the rule’s ID by default).

minLength1
ReturnsExpand Collapse
type RuleEditResponseUnion interface{…}

A result.

One of the following:
type RuleEditResponseArray []unknown
UnionString
UnionFloat
UnionBool
type RuleEditResponseRuleset struct{…}

A ruleset object.

ID string

The unique ID of the ruleset.

Kind Kind

The kind of the ruleset.

One of the following:
const KindManaged Kind = "managed"
const KindCustom Kind = "custom"
const KindRoot Kind = "root"
const KindZone Kind = "zone"
LastUpdated Time

The timestamp of when the ruleset was last modified.

formatdate-time
Name string

The human-readable name of the ruleset.

minLength1
Phase Phase

The phase of the ruleset.

One of the following:
const PhaseDDoSL4 Phase = "ddos_l4"
const PhaseDDoSL7 Phase = "ddos_l7"
const PhaseHTTPConfigSettings Phase = "http_config_settings"
const PhaseHTTPCustomErrors Phase = "http_custom_errors"
const PhaseHTTPLogCustomFields Phase = "http_log_custom_fields"
const PhaseHTTPRatelimit Phase = "http_ratelimit"
const PhaseHTTPRequestCacheSettings Phase = "http_request_cache_settings"
const PhaseHTTPRequestDynamicRedirect Phase = "http_request_dynamic_redirect"
const PhaseHTTPRequestFirewallCustom Phase = "http_request_firewall_custom"
const PhaseHTTPRequestFirewallManaged Phase = "http_request_firewall_managed"
const PhaseHTTPRequestLateTransform Phase = "http_request_late_transform"
const PhaseHTTPRequestOrigin Phase = "http_request_origin"
const PhaseHTTPRequestRedirect Phase = "http_request_redirect"
const PhaseHTTPRequestSanitize Phase = "http_request_sanitize"
const PhaseHTTPRequestSBFM Phase = "http_request_sbfm"
const PhaseHTTPRequestTransform Phase = "http_request_transform"
const PhaseHTTPResponseCacheSettings Phase = "http_response_cache_settings"
const PhaseHTTPResponseCompression Phase = "http_response_compression"
const PhaseHTTPResponseFirewallCustom Phase = "http_response_firewall_custom"
const PhaseHTTPResponseFirewallManaged Phase = "http_response_firewall_managed"
const PhaseHTTPResponseHeadersTransform Phase = "http_response_headers_transform"
const PhaseMagicTransit Phase = "magic_transit"
const PhaseMagicTransitIDsManaged Phase = "magic_transit_ids_managed"
const PhaseMagicTransitManaged Phase = "magic_transit_managed"
const PhaseMagicTransitRatelimit Phase = "magic_transit_ratelimit"
Rules []RuleEditResponseRulesetRule

The list of rules in the ruleset.

One of the following:
type RuleEditResponseRulesetRulesBlockRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesChallengeRule struct{…}
ID string

The unique ID of the rule.

Action RuleEditResponseRulesetRulesChallengeRuleAction

The action to perform when the rule matches.

Enabled bool

Whether the rule should be executed.

Expression string

The expression defining which traffic will match the rule.

minLength1
LastUpdated Time

The timestamp of when the rule was last modified.

formatdate-time
Ref string

The reference of the rule (the rule’s ID by default).

minLength1
Version string

The version of the rule.

ActionParameters unknownOptional

The parameters configuring the rule’s action.

Categories []stringOptional

The categories of the rule.

Description stringOptional

An informative description of the rule.

ExposedCredentialCheck RuleEditResponseRulesetRulesChallengeRuleExposedCredentialCheckOptional

Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Logging LoggingOptional

An object configuring the rule’s logging behavior.

Enabled bool

Whether to generate a log when the rule matches.

Ratelimit RuleEditResponseRulesetRulesChallengeRuleRatelimitOptional

An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
type RuleEditResponseRulesetRulesResponseCompressionRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesDDoSDynamicRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesExecuteRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesForceConnectionCloseRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesJavaScriptChallengeRule struct{…}
ID string

The unique ID of the rule.

Action RuleEditResponseRulesetRulesJavaScriptChallengeRuleAction

The action to perform when the rule matches.

Enabled bool

Whether the rule should be executed.

Expression string

The expression defining which traffic will match the rule.

minLength1
LastUpdated Time

The timestamp of when the rule was last modified.

formatdate-time
Ref string

The reference of the rule (the rule’s ID by default).

minLength1
Version string

The version of the rule.

ActionParameters unknownOptional

The parameters configuring the rule’s action.

Categories []stringOptional

The categories of the rule.

Description stringOptional

An informative description of the rule.

ExposedCredentialCheck RuleEditResponseRulesetRulesJavaScriptChallengeRuleExposedCredentialCheckOptional

Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Logging LoggingOptional

An object configuring the rule’s logging behavior.

Enabled bool

Whether to generate a log when the rule matches.

Ratelimit RuleEditResponseRulesetRulesJavaScriptChallengeRuleRatelimitOptional

An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
type RuleEditResponseRulesetRulesLogRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesLogCustomFieldRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesManagedChallengeRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesRedirectRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesRewriteRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesRouteRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesScoreRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesServeErrorRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesSetCacheControlRule struct{…}
ID string

The unique ID of the rule.

Action RuleEditResponseRulesetRulesSetCacheControlRuleAction

The action to perform when the rule matches.

Enabled bool
Expression string

The expression defining which traffic will match the rule.

minLength1
LastUpdated Time

The timestamp of when the rule was last modified.

formatdate-time
Ref string

The reference of the rule (the rule’s ID by default).

minLength1
Version string

The version of the rule.

ActionParameters RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersOptional

The parameters configuring the rule’s action.

Immutable RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersImmutableRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

MaxAge RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeOptional

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirective struct{…}

Set the directive with a duration value in seconds.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeSetDirectiveOperation = "remove"
Value int64

The duration value in seconds for the directive.

minimum0
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMaxAgeRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

MustRevalidate RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustRevalidateRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

MustUnderstand RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersMustUnderstandRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

NoCache RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheOptional

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirective struct{…}

Set the directive with optional qualifiers.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

Qualifiers []stringOptional

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoCacheRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

NoStore RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoStoreRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

NoTransform RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersNoTransformRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

Private RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateOptional

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirective struct{…}

Set the directive with optional qualifiers.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

Qualifiers []stringOptional

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPrivateRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

ProxyRevalidate RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersProxyRevalidateRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

Public RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicOptional

A cache-control directive configuration.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirective struct{…}

Set the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicSetDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersPublicRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

SMaxage RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageOptional

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirective struct{…}

Set the directive with a duration value in seconds.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageSetDirectiveOperation = "remove"
Value int64

The duration value in seconds for the directive.

minimum0
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersSMaxageRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

StaleIfError RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorOptional

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirective struct{…}

Set the directive with a duration value in seconds.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorSetDirectiveOperation = "remove"
Value int64

The duration value in seconds for the directive.

minimum0
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleIfErrorRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

StaleWhileRevalidate RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateOptional

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective struct{…}

Set the directive with a duration value in seconds.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirectiveOperation = "remove"
Value int64

The duration value in seconds for the directive.

minimum0
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

type RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective struct{…}

Remove the directive.

Operation RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperation

The operation to perform on the cache-control directive.

One of the following:
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperationSet RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperation = "set"
const RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperationRemove RuleEditResponseRulesetRulesSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirectiveOperation = "remove"
CloudflareOnly boolOptional

Whether the directive should only be applied to the Cloudflare CDN cache.

Categories []stringOptional

The categories of the rule.

Description stringOptional

An informative description of the rule.

ExposedCredentialCheck RuleEditResponseRulesetRulesSetCacheControlRuleExposedCredentialCheckOptional

Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Logging LoggingOptional

An object configuring the rule’s logging behavior.

Enabled bool

Whether to generate a log when the rule matches.

Ratelimit RuleEditResponseRulesetRulesSetCacheControlRuleRatelimitOptional

An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
type RuleEditResponseRulesetRulesSetCacheSettingsRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesSetCacheTagsRule struct{…}
ID string

The unique ID of the rule.

Action RuleEditResponseRulesetRulesSetCacheTagsRuleAction

The action to perform when the rule matches.

Enabled bool
Expression string

The expression defining which traffic will match the rule.

minLength1
LastUpdated Time

The timestamp of when the rule was last modified.

formatdate-time
Ref string

The reference of the rule (the rule’s ID by default).

minLength1
Version string

The version of the rule.

ActionParameters RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersOptional

The parameters configuring the rule’s action.

One of the following:
type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValues struct{…}

Add cache tags using a list of values.

Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsValuesOperation = "set"
Values []string

A list of cache tag values.

type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpression struct{…}

Add cache tags using an expression.

Expression string

An expression that evaluates to an array of cache tag values.

minLength1
Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersAddCacheTagsExpressionOperation = "set"
type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValues struct{…}

Remove cache tags using a list of values.

Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsValuesOperation = "set"
Values []string

A list of cache tag values.

type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpression struct{…}

Remove cache tags using an expression.

Expression string

An expression that evaluates to an array of cache tag values.

minLength1
Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersRemoveCacheTagsExpressionOperation = "set"
type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValues struct{…}

Set cache tags using a list of values.

Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsValuesOperation = "set"
Values []string

A list of cache tag values.

type RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpression struct{…}

Set cache tags using an expression.

Expression string

An expression that evaluates to an array of cache tag values.

minLength1
Operation RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperation

The operation to perform on the cache tags.

One of the following:
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperationAdd RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperation = "add"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperationRemove RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperation = "remove"
const RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperationSet RuleEditResponseRulesetRulesSetCacheTagsRuleActionParametersSetCacheTagsExpressionOperation = "set"
Categories []stringOptional

The categories of the rule.

Description stringOptional

An informative description of the rule.

ExposedCredentialCheck RuleEditResponseRulesetRulesSetCacheTagsRuleExposedCredentialCheckOptional

Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Logging LoggingOptional

An object configuring the rule’s logging behavior.

Enabled bool

Whether to generate a log when the rule matches.

Ratelimit RuleEditResponseRulesetRulesSetCacheTagsRuleRatelimitOptional

An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
type RuleEditResponseRulesetRulesSetConfigurationRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesSkipRule struct{…}
ID string
Action string
Enabled bool
Expression string
Ref string
type RuleEditResponseRulesetRulesTransformResponseHTMLRule struct{…}
ID string

The unique ID of the rule.

Action RuleEditResponseRulesetRulesTransformResponseHTMLRuleAction

The action to perform when the rule matches.

Enabled bool
Expression string

The expression defining which traffic will match the rule.

minLength1
LastUpdated Time

The timestamp of when the rule was last modified.

formatdate-time
Ref string

The reference of the rule (the rule’s ID by default).

minLength1
Version string

The version of the rule.

ActionParameters RuleEditResponseRulesetRulesTransformResponseHTMLRuleActionParametersOptional

The parameters configuring the rule’s action.

Categories []stringOptional

The categories of the rule.

Description stringOptional

An informative description of the rule.

ExposedCredentialCheck RuleEditResponseRulesetRulesTransformResponseHTMLRuleExposedCredentialCheckOptional

Configuration for exposed credential checking.

PasswordExpression string

An expression that selects the password used in the credentials check.

minLength1
UsernameExpression string

An expression that selects the user ID used in the credentials check.

minLength1
Logging LoggingOptional

An object configuring the rule’s logging behavior.

Enabled bool

Whether to generate a log when the rule matches.

Ratelimit RuleEditResponseRulesetRulesTransformResponseHTMLRuleRatelimitOptional

An object configuring the rule’s rate limit behavior.

Characteristics []string

Characteristics of the request on which the rate limit counter will be incremented.

Period int64

Period in seconds over which the counter is being incremented.

minimum0
CountingExpression stringOptional

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
MitigationTimeout int64Optional

Period of time in seconds after which the action will be disabled following its first execution.

RequestsPerPeriod int64Optional

The threshold of requests per period after which the action will be executed for the first time.

minimum1
RequestsToOrigin boolOptional

Whether counting is only performed when an origin is reached.

ScorePerPeriod int64Optional

The score threshold per period for which the action will be executed the first time.

ScoreResponseHeaderName stringOptional

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
Version string

The version of the ruleset.

Description stringOptional

An informative description of the ruleset.

Update an account or zone ruleset rule

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/rulesets"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.Rulesets.Rules.Edit(
    context.TODO(),
    "2f2feab2026849078ba485f918791bdc",
    "3a03d665bac047339bb530ecb439a90d",
    rulesets.RuleEditParams{
      Body: rulesets.RuleEditParamsBodyBlockRule(rulesets.RuleEditParamsBodyBlockRule{
        BlockRuleParam: rulesets.BlockRuleParam{

        },
      }),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
{
  "errors": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "messages": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "result": {},
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "messages": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "result": {},
  "success": true
}