cloudflare
Version:
The official TypeScript library for the Cloudflare API
3,534 lines • 128 kB
TypeScript
import { APIResource } from "../../../core/resource.js";
import * as RulesAPI from "../rules.js";
import * as RulesetsAPI from "../rulesets.js";
import * as VersionsAPI from "./versions.js";
import { BaseVersions, VersionGetParams, VersionGetResponse, VersionListParams, VersionListResponse, VersionListResponsesSinglePage, Versions } from "./versions.js";
import { APIPromise } from "../../../core/api-promise.js";
import { RequestOptions } from "../../../internal/request-options.js";
export declare class BasePhases extends APIResource {
static readonly _key: readonly ['rulesets', 'phases'];
/**
* Updates an account or zone entry point ruleset, creating a new version.
*
* @example
* ```ts
* const phase = await client.rulesets.phases.update(
* 'http_request_firewall_custom',
* { account_id: 'account_id' },
* );
* ```
*/
update(rulesetPhase: RulesetsAPI.PhaseParam, params: PhaseUpdateParams, options?: RequestOptions): APIPromise<PhaseUpdateResponse>;
/**
* Fetches the latest version of the account or zone entry point ruleset for a
* given phase.
*
* @example
* ```ts
* const phase = await client.rulesets.phases.get(
* 'http_request_firewall_custom',
* { account_id: 'account_id' },
* );
* ```
*/
get(rulesetPhase: RulesetsAPI.PhaseParam, params?: PhaseGetParams | null | undefined, options?: RequestOptions): APIPromise<PhaseGetResponse>;
}
export declare class Phases extends BasePhases {
versions: VersionsAPI.Versions;
}
/**
* A result.
*/
export type PhaseUpdateResponse = PhaseUpdateResponse.Ruleset | unknown;
export declare namespace PhaseUpdateResponse {
/**
* A ruleset object.
*/
interface Ruleset {
/**
* The unique ID of the ruleset.
*/
id: string;
/**
* The kind of the ruleset.
*/
kind: RulesetsAPI.Kind;
/**
* The timestamp of when the ruleset was last modified.
*/
last_updated: string;
/**
* The human-readable name of the ruleset.
*/
name: string;
/**
* The phase of the ruleset.
*/
phase: RulesetsAPI.Phase;
/**
* The list of rules in the ruleset.
*/
rules: Array<Ruleset.BlockRule | Ruleset.ChallengeRule | Ruleset.ResponseCompressionRule | Ruleset.DDoSDynamicRule | Ruleset.ExecuteRule | Ruleset.ForceConnectionCloseRule | Ruleset.JavaScriptChallengeRule | Ruleset.LogRule | Ruleset.LogCustomFieldRule | Ruleset.ManagedChallengeRule | Ruleset.RedirectRule | Ruleset.RewriteRule | Ruleset.RouteRule | Ruleset.ScoreRule | Ruleset.ServeErrorRule | Ruleset.SetCacheControlRule | Ruleset.SetCacheSettingsRule | Ruleset.SetCacheTagsRule | Ruleset.SetConfigurationRule | Ruleset.SkipRule | Ruleset.TransformResponseHTMLRule>;
/**
* The version of the ruleset.
*/
version: string;
/**
* An informative description of the ruleset.
*/
description?: string;
}
namespace Ruleset {
interface BlockRule extends Omit<RulesAPI.BlockRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ChallengeRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'challenge';
/**
* Whether the rule should be executed.
*/
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: ChallengeRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: ChallengeRule.Ratelimit;
}
namespace ChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface ResponseCompressionRule extends Omit<RulesAPI.CompressResponseRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface DDoSDynamicRule extends Omit<RulesAPI.DDoSDynamicRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ExecuteRule extends Omit<RulesAPI.ExecuteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ForceConnectionCloseRule extends Omit<RulesAPI.ForceConnectionCloseRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface JavaScriptChallengeRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'js_challenge';
/**
* Whether the rule should be executed.
*/
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: JavaScriptChallengeRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: JavaScriptChallengeRule.Ratelimit;
}
namespace JavaScriptChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface LogRule extends Omit<RulesAPI.LogRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface LogCustomFieldRule extends Omit<RulesAPI.LogCustomFieldRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ManagedChallengeRule extends Omit<RulesAPI.ManagedChallengeRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RedirectRule extends Omit<RulesAPI.RedirectRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RewriteRule extends Omit<RulesAPI.RewriteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RouteRule extends Omit<RulesAPI.RouteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ScoreRule extends Omit<RulesAPI.ScoreRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ServeErrorRule extends Omit<RulesAPI.ServeErrorRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SetCacheControlRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'set_cache_control';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: SetCacheControlRule.ActionParameters;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: SetCacheControlRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: SetCacheControlRule.Ratelimit;
}
namespace SetCacheControlRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* A cache-control directive configuration.
*/
immutable?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'max-age'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-understand'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
'no-cache'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-store'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-transform'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
private?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'proxy-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
public?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
's-maxage'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-if-error'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-while-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
}
namespace ActionParameters {
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface SetCacheSettingsRule extends Omit<RulesAPI.SetCacheSettingsRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SetCacheTagsRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'set_cache_tags';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: SetCacheTagsRule.AddCacheTagsValues | SetCacheTagsRule.AddCacheTagsExpression | SetCacheTagsRule.RemoveCacheTagsValues | SetCacheTagsRule.RemoveCacheTagsExpression | SetCacheTagsRule.SetCacheTagsValues | SetCacheTagsRule.SetCacheTagsExpression;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: SetCacheTagsRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: SetCacheTagsRule.Ratelimit;
}
namespace SetCacheTagsRule {
/**
* Add cache tags using a list of values.
*/
interface AddCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Add cache tags using an expression.
*/
interface AddCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Remove cache tags using a list of values.
*/
interface RemoveCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Remove cache tags using an expression.
*/
interface RemoveCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Set cache tags using a list of values.
*/
interface SetCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Set cache tags using an expression.
*/
interface SetCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface SetConfigurationRule extends Omit<RulesAPI.SetConfigRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SkipRule extends Omit<RulesAPI.SkipRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface TransformResponseHTMLRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'transform_response_html';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: TransformResponseHTMLRule.ActionParameters;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: TransformResponseHTMLRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: TransformResponseHTMLRule.Ratelimit;
}
namespace TransformResponseHTMLRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* Enables the link maze transformation on the response.
*/
link_maze: unknown;
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
}
}
/**
* A ruleset object.
*/
export interface PhaseGetResponse {
/**
* The unique ID of the ruleset.
*/
id: string;
/**
* The kind of the ruleset.
*/
kind: RulesetsAPI.Kind;
/**
* The timestamp of when the ruleset was last modified.
*/
last_updated: string;
/**
* The human-readable name of the ruleset.
*/
name: string;
/**
* The phase of the ruleset.
*/
phase: RulesetsAPI.Phase;
/**
* The list of rules in the ruleset.
*/
rules: Array<PhaseGetResponse.BlockRule | PhaseGetResponse.ChallengeRule | PhaseGetResponse.ResponseCompressionRule | PhaseGetResponse.DDoSDynamicRule | PhaseGetResponse.ExecuteRule | PhaseGetResponse.ForceConnectionCloseRule | PhaseGetResponse.JavaScriptChallengeRule | PhaseGetResponse.LogRule | PhaseGetResponse.LogCustomFieldRule | PhaseGetResponse.ManagedChallengeRule | PhaseGetResponse.RedirectRule | PhaseGetResponse.RewriteRule | PhaseGetResponse.RouteRule | PhaseGetResponse.ScoreRule | PhaseGetResponse.ServeErrorRule | PhaseGetResponse.SetCacheControlRule | PhaseGetResponse.SetCacheSettingsRule | PhaseGetResponse.SetCacheTagsRule | PhaseGetResponse.SetConfigurationRule | PhaseGetResponse.SkipRule | PhaseGetResponse.TransformResponseHTMLRule>;
/**
* The version of the ruleset.
*/
version: string;
/**
* An informative description of the ruleset.
*/
description?: string;
}
export declare namespace PhaseGetResponse {
interface BlockRule extends Omit<RulesAPI.BlockRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ChallengeRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'challenge';
/**
* Whether the rule should be executed.
*/
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: ChallengeRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: ChallengeRule.Ratelimit;
}
namespace ChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface ResponseCompressionRule extends Omit<RulesAPI.CompressResponseRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface DDoSDynamicRule extends Omit<RulesAPI.DDoSDynamicRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ExecuteRule extends Omit<RulesAPI.ExecuteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ForceConnectionCloseRule extends Omit<RulesAPI.ForceConnectionCloseRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface JavaScriptChallengeRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'js_challenge';
/**
* Whether the rule should be executed.
*/
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: JavaScriptChallengeRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: JavaScriptChallengeRule.Ratelimit;
}
namespace JavaScriptChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface LogRule extends Omit<RulesAPI.LogRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface LogCustomFieldRule extends Omit<RulesAPI.LogCustomFieldRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ManagedChallengeRule extends Omit<RulesAPI.ManagedChallengeRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RedirectRule extends Omit<RulesAPI.RedirectRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RewriteRule extends Omit<RulesAPI.RewriteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface RouteRule extends Omit<RulesAPI.RouteRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ScoreRule extends Omit<RulesAPI.ScoreRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface ServeErrorRule extends Omit<RulesAPI.ServeErrorRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SetCacheControlRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'set_cache_control';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: SetCacheControlRule.ActionParameters;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: SetCacheControlRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: SetCacheControlRule.Ratelimit;
}
namespace SetCacheControlRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* A cache-control directive configuration.
*/
immutable?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'max-age'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-understand'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
'no-cache'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-store'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-transform'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
private?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'proxy-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
public?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
's-maxage'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-if-error'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-while-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
}
namespace ActionParameters {
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface SetCacheSettingsRule extends Omit<RulesAPI.SetCacheSettingsRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SetCacheTagsRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'set_cache_tags';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: SetCacheTagsRule.AddCacheTagsValues | SetCacheTagsRule.AddCacheTagsExpression | SetCacheTagsRule.RemoveCacheTagsValues | SetCacheTagsRule.RemoveCacheTagsExpression | SetCacheTagsRule.SetCacheTagsValues | SetCacheTagsRule.SetCacheTagsExpression;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: SetCacheTagsRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: SetCacheTagsRule.Ratelimit;
}
namespace SetCacheTagsRule {
/**
* Add cache tags using a list of values.
*/
interface AddCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Add cache tags using an expression.
*/
interface AddCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Remove cache tags using a list of values.
*/
interface RemoveCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Remove cache tags using an expression.
*/
interface RemoveCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Set cache tags using a list of values.
*/
interface SetCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Set cache tags using an expression.
*/
interface SetCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface SetConfigurationRule extends Omit<RulesAPI.SetConfigRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface SkipRule extends Omit<RulesAPI.SkipRule, 'action'> {
id: string;
action: string;
enabled: boolean;
expression: string;
ref: string;
}
interface TransformResponseHTMLRule {
/**
* The unique ID of the rule.
*/
id: string;
/**
* The action to perform when the rule matches.
*/
action: 'transform_response_html';
enabled: boolean;
/**
* The expression defining which traffic will match the rule.
*/
expression: string;
/**
* The timestamp of when the rule was last modified.
*/
last_updated: string;
/**
* The reference of the rule (the rule's ID by default).
*/
ref: string;
/**
* The version of the rule.
*/
version: string;
/**
* The parameters configuring the rule's action.
*/
action_parameters?: TransformResponseHTMLRule.ActionParameters;
/**
* The categories of the rule.
*/
categories?: Array<string>;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: TransformResponseHTMLRule.ExposedCredentialCheck;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.Logging;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: TransformResponseHTMLRule.Ratelimit;
}
namespace TransformResponseHTMLRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* Enables the link maze transformation on the response.
*/
link_maze: unknown;
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
}
export interface PhaseUpdateParams {
/**
* Path param: The Account ID to use for this endpoint. Mutually exclusive with the
* Zone ID.
*/
account_id?: string;
/**
* Path param: The Zone ID to use for this endpoint. Mutually exclusive with the
* Account ID.
*/
zone_id?: string;
/**
* 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.
*/
dry_run?: boolean;
/**
* Body param: An informative description of the ruleset.
*/
description?: string;
/**
* Body param: The human-readable name of the ruleset.
*/
name?: string;
/**
* Body param: The list of rules in the ruleset.
*/
rules?: Array<RulesAPI.BlockRuleParam | PhaseUpdateParams.RulesetsChallengeRule | RulesAPI.CompressResponseRuleParam | RulesAPI.DDoSDynamicRuleParam | RulesAPI.ExecuteRuleParam | RulesAPI.ForceConnectionCloseRuleParam | PhaseUpdateParams.RulesetsJSChallengeRule | RulesAPI.LogRuleParam | RulesAPI.LogCustomFieldRuleParam | RulesAPI.ManagedChallengeRuleParam | RulesAPI.RedirectRuleParam | RulesAPI.RewriteRuleParam | RulesAPI.RouteRuleParam | RulesAPI.ScoreRuleParam | RulesAPI.ServeErrorRuleParam | PhaseUpdateParams.RulesetsSetCacheControlRule | RulesAPI.SetCacheSettingsRuleParam | PhaseUpdateParams.RulesetsSetCacheTagsRule | RulesAPI.SetConfigRuleParam | RulesAPI.SkipRuleParam | PhaseUpdateParams.RulesetsTransformResponseHTMLRule>;
}
export declare namespace PhaseUpdateParams {
interface RulesetsChallengeRule {
/**
* The unique ID of the rule.
*/
id?: string;
/**
* The action to perform when the rule matches.
*/
action?: 'challenge';
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Whether the rule should be executed.
*/
enabled?: boolean;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck;
/**
* The expression defining which traffic will match the rule.
*/
expression?: string;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.LoggingParam;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: RulesetsChallengeRule.Ratelimit;
/**
* The reference of the rule (the rule's ID by default).
*/
ref?: string;
}
namespace RulesetsChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface RulesetsJSChallengeRule {
/**
* The unique ID of the rule.
*/
id?: string;
/**
* The action to perform when the rule matches.
*/
action?: 'js_challenge';
/**
* The parameters configuring the rule's action.
*/
action_parameters?: unknown;
/**
* An informative description of the rule.
*/
description?: string;
/**
* Whether the rule should be executed.
*/
enabled?: boolean;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck;
/**
* The expression defining which traffic will match the rule.
*/
expression?: string;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.LoggingParam;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: RulesetsJSChallengeRule.Ratelimit;
/**
* The reference of the rule (the rule's ID by default).
*/
ref?: string;
}
namespace RulesetsJSChallengeRule {
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface RulesetsSetCacheControlRule {
/**
* The unique ID of the rule.
*/
id?: string;
/**
* The action to perform when the rule matches.
*/
action?: 'set_cache_control';
/**
* The parameters configuring the rule's action.
*/
action_parameters?: RulesetsSetCacheControlRule.ActionParameters;
/**
* An informative description of the rule.
*/
description?: string;
enabled?: boolean;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: RulesetsSetCacheControlRule.ExposedCredentialCheck;
/**
* The expression defining which traffic will match the rule.
*/
expression?: string;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.LoggingParam;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: RulesetsSetCacheControlRule.Ratelimit;
/**
* The reference of the rule (the rule's ID by default).
*/
ref?: string;
}
namespace RulesetsSetCacheControlRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* A cache-control directive configuration.
*/
immutable?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'max-age'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'must-understand'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
'no-cache'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-store'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'no-transform'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts optional qualifiers (header
* names).
*/
private?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
'proxy-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration.
*/
public?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
's-maxage'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-if-error'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
/**
* A cache-control directive configuration that accepts a duration value in
* seconds.
*/
'stale-while-revalidate'?: ActionParameters.SetDirective | ActionParameters.RemoveDirective;
}
namespace ActionParameters {
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with optional qualifiers.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
/**
* Optional list of header names to qualify the directive (e.g., for "private" or
* "no-cache" directives).
*/
qualifiers?: Array<string>;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Set the directive with a duration value in seconds.
*/
interface SetDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* The duration value in seconds for the directive.
*/
value: number;
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
/**
* Remove the directive.
*/
interface RemoveDirective {
/**
* The operation to perform on the cache-control directive.
*/
operation: 'set' | 'remove';
/**
* Whether the directive should only be applied to the Cloudflare CDN cache.
*/
cloudflare_only?: boolean;
}
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface RulesetsSetCacheTagsRule {
/**
* The unique ID of the rule.
*/
id?: string;
/**
* The action to perform when the rule matches.
*/
action?: 'set_cache_tags';
/**
* The parameters configuring the rule's action.
*/
action_parameters?: RulesetsSetCacheTagsRule.AddCacheTagsValues | RulesetsSetCacheTagsRule.AddCacheTagsExpression | RulesetsSetCacheTagsRule.RemoveCacheTagsValues | RulesetsSetCacheTagsRule.RemoveCacheTagsExpression | RulesetsSetCacheTagsRule.SetCacheTagsValues | RulesetsSetCacheTagsRule.SetCacheTagsExpression;
/**
* An informative description of the rule.
*/
description?: string;
enabled?: boolean;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: RulesetsSetCacheTagsRule.ExposedCredentialCheck;
/**
* The expression defining which traffic will match the rule.
*/
expression?: string;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.LoggingParam;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: RulesetsSetCacheTagsRule.Ratelimit;
/**
* The reference of the rule (the rule's ID by default).
*/
ref?: string;
}
namespace RulesetsSetCacheTagsRule {
/**
* Add cache tags using a list of values.
*/
interface AddCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Add cache tags using an expression.
*/
interface AddCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Remove cache tags using a list of values.
*/
interface RemoveCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Remove cache tags using an expression.
*/
interface RemoveCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Set cache tags using a list of values.
*/
interface SetCacheTagsValues {
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
/**
* A list of cache tag values.
*/
values: Array<string>;
}
/**
* Set cache tags using an expression.
*/
interface SetCacheTagsExpression {
/**
* An expression that evaluates to an array of cache tag values.
*/
expression: string;
/**
* The operation to perform on the cache tags.
*/
operation: 'add' | 'remove' | 'set';
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
interface RulesetsTransformResponseHTMLRule {
/**
* The unique ID of the rule.
*/
id?: string;
/**
* The action to perform when the rule matches.
*/
action?: 'transform_response_html';
/**
* The parameters configuring the rule's action.
*/
action_parameters?: RulesetsTransformResponseHTMLRule.ActionParameters;
/**
* An informative description of the rule.
*/
description?: string;
enabled?: boolean;
/**
* Configuration for exposed credential checking.
*/
exposed_credential_check?: RulesetsTransformResponseHTMLRule.ExposedCredentialCheck;
/**
* The expression defining which traffic will match the rule.
*/
expression?: string;
/**
* An object configuring the rule's logging behavior.
*/
logging?: RulesAPI.LoggingParam;
/**
* An object configuring the rule's rate limit behavior.
*/
ratelimit?: RulesetsTransformResponseHTMLRule.Ratelimit;
/**
* The reference of the rule (the rule's ID by default).
*/
ref?: string;
}
namespace RulesetsTransformResponseHTMLRule {
/**
* The parameters configuring the rule's action.
*/
interface ActionParameters {
/**
* Enables the link maze transformation on the response.
*/
link_maze: unknown;
}
/**
* Configuration for exposed credential checking.
*/
interface ExposedCredentialCheck {
/**
* An expression that selects the password used in the credentials check.
*/
password_expression: string;
/**
* An expression that selects the user ID used in the credentials check.
*/
username_expression: string;
}
/**
* An object configuring the rule's rate limit behavior.
*/
interface Ratelimit {
/**
* Characteristics of the request on which the rate limit counter will be
* incremented.
*/
characteristics: Array<string>;
/**
* Period in seconds over which the counter is being incremented.
*/
period: number;
/**
* An expression that defines when the rate limit counter should be incremented. It
* defaults to the same as the rule's expression.
*/
counting_expression?: string;
/**
* Period of time in seconds after which the action will be disabled following its
* first execution.
*/
mitigation_timeout?: number;
/**
* The threshold of requests per period after which the action will be executed for
* the first time.
*/
requests_per_period?: number;
/**
* Whether counting is only performed when an origin is reached.
*/
requests_to_origin?: boolean;
/**
* The score threshold per period for which the action will be executed the first
* time.
*/
score_per_period?: number;
/**
* A response header name provided by the origin, which contains the score to
* increment rate limit counter with.
*/
score_response_header_name?: string;
}
}
}
export interface PhaseGetParams {
/**
* The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
*/
account_id?: string;
/**
* The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
*/
zone_id?: string;
}
export declare namespace Phases {
export { type PhaseUpdateResponse as PhaseUpdateResponse, type PhaseGetResponse as PhaseGetResponse, type PhaseUpdateParams as PhaseUpdateParams, type PhaseGetParams as PhaseGetParams, };
export { Versions as Versions, BaseVersions as BaseVersions, type VersionListResponse as VersionListResponse, type VersionGetResponse as VersionGetResponse, type VersionListResponsesSinglePage as VersionListResponsesSinglePage, type VersionListParams as VersionListParams, type VersionGetParams as VersionGetParams, };
}
//# sourceMappingURL=phases.d.ts.map