UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

1,674 lines 155 kB
import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import * as RulesAPI from 'cloudflare/resources/rulesets/rules'; export declare class Rules extends APIResource { /** * Adds a new rule to an account or zone ruleset. The rule will be added to the end * of the existing list of rules in the ruleset by default. */ create(rulesetId: string, params: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise<RuleCreateResponse>; /** * Deletes an existing rule from an account or zone ruleset. */ delete(rulesetId: string, ruleId: string, params?: RuleDeleteParams, options?: Core.RequestOptions): Core.APIPromise<RuleDeleteResponse>; delete(rulesetId: string, ruleId: string, options?: Core.RequestOptions): Core.APIPromise<RuleDeleteResponse>; /** * Updates an existing rule in an account or zone ruleset. */ edit(rulesetId: string, ruleId: string, params: RuleEditParams, options?: Core.RequestOptions): Core.APIPromise<RuleEditResponse>; } export interface BlockRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'block'; /** * The parameters configuring the rule's action. */ action_parameters?: BlockRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace BlockRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * The response to show when the block is applied. */ response?: ActionParameters.Response; } namespace ActionParameters { /** * The response to show when the block is applied. */ interface Response { /** * The content to return. */ content: string; /** * The type of the content to return. */ content_type: string; /** * The status code to return. */ status_code: number; } } } export interface ChallengeRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * 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; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export interface CompressResponseRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'compress_response'; /** * The parameters configuring the rule's action. */ action_parameters?: CompressResponseRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace CompressResponseRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Custom order for compression algorithms. */ algorithms?: Array<ActionParameters.Algorithm>; } namespace ActionParameters { /** * Compression algorithm to enable. */ interface Algorithm { /** * Name of compression algorithm to enable. */ name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; } } } export interface ExecuteRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'execute'; /** * The parameters configuring the rule's action. */ action_parameters?: ExecuteRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace ExecuteRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * The ID of the ruleset to execute. */ id: string; /** * The configuration to use for matched data logging. */ matched_data?: ActionParameters.MatchedData; /** * A set of overrides to apply to the target ruleset. */ overrides?: ActionParameters.Overrides; } namespace ActionParameters { /** * The configuration to use for matched data logging. */ interface MatchedData { /** * The public key to encrypt matched data logs with. */ public_key: string; } /** * A set of overrides to apply to the target ruleset. */ interface Overrides { /** * An action to override all rules with. This option has lower precedence than rule * and category overrides. */ action?: string; /** * A list of category-level overrides. This option has the second-highest * precedence after rule-level overrides. */ categories?: Array<Overrides.Category>; /** * Whether to enable execution of all rules. This option has lower precedence than * rule and category overrides. */ enabled?: boolean; /** * A list of rule-level overrides. This option has the highest precedence. */ rules?: Array<Overrides.Rule>; /** * A sensitivity level to set for all rules. This option has lower precedence than * rule and category overrides and is only applicable for DDoS phases. */ sensitivity_level?: 'default' | 'medium' | 'low' | 'eoff'; } namespace Overrides { /** * A category-level override */ interface Category { /** * The name of the category to override. */ category: string; /** * The action to override rules in the category with. */ action?: string; /** * Whether to enable execution of rules in the category. */ enabled?: boolean; /** * The sensitivity level to use for rules in the category. */ sensitivity_level?: 'default' | 'medium' | 'low' | 'eoff'; } /** * A rule-level override */ interface Rule { /** * The ID of the rule to override. */ id: string; /** * The action to override the rule with. */ action?: string; /** * Whether to enable execution of the rule. */ enabled?: boolean; /** * The score threshold to use for the rule. */ score_threshold?: number; /** * The sensitivity level to use for the rule. */ sensitivity_level?: 'default' | 'medium' | 'low' | 'eoff'; } } } } export interface JSChallengeRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * 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; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export interface LogRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'log'; /** * 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; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } /** * An object configuring the rule's logging behavior. */ export interface Logging { /** * Whether to generate a log when the rule matches. */ enabled: boolean; } export interface ManagedChallengeRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'managed_challenge'; /** * 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; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export interface RedirectRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'redirect'; /** * The parameters configuring the rule's action. */ action_parameters?: RedirectRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace RedirectRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Serve a redirect based on a bulk list lookup. */ from_list?: ActionParameters.FromList; /** * Serve a redirect based on the request properties. */ from_value?: ActionParameters.FromValue; } namespace ActionParameters { /** * Serve a redirect based on a bulk list lookup. */ interface FromList { /** * Expression that evaluates to the list lookup key. */ key?: string; /** * The name of the list to match against. */ name?: string; } /** * Serve a redirect based on the request properties. */ interface FromValue { /** * Keep the query string of the original request. */ preserve_query_string?: boolean; /** * The status code to be used for the redirect. */ status_code?: 301 | 302 | 303 | 307 | 308; /** * The URL to redirect the request to. */ target_url?: FromValue.StaticURLRedirect | FromValue.DynamicURLRedirect; } namespace FromValue { interface StaticURLRedirect { /** * The URL to redirect the request to. */ value?: string; } interface DynamicURLRedirect { /** * An expression to evaluate to get the URL to redirect the request to. */ expression?: string; } } } } export interface RewriteRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'rewrite'; /** * The parameters configuring the rule's action. */ action_parameters?: RewriteRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace RewriteRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Map of request headers to modify. */ headers?: Record<string, ActionParameters.RemoveHeader | ActionParameters.StaticHeader | ActionParameters.DynamicHeader>; /** * URI to rewrite the request to. */ uri?: ActionParameters.URI; } namespace ActionParameters { /** * Remove the header from the request. */ interface RemoveHeader { operation: 'remove'; } /** * Set a request header with a static value. */ interface StaticHeader { operation: 'set'; /** * Static value for the header. */ value: string; } /** * Set a request header with a dynamic value. */ interface DynamicHeader { /** * Expression for the header value. */ expression: string; operation: 'set'; } /** * URI to rewrite the request to. */ interface URI { /** * Path portion rewrite. */ path?: RulesAPI.RewriteURIPart; /** * Query portion rewrite. */ query?: RulesAPI.RewriteURIPart; } } } export type RewriteURIPart = RewriteURIPart.StaticValue | RewriteURIPart.DynamicValue; export declare namespace RewriteURIPart { interface StaticValue { /** * Predefined replacement value. */ value: string; } interface DynamicValue { /** * Expression to evaluate for the replacement value. */ expression: string; } } export interface RouteRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'route'; /** * The parameters configuring the rule's action. */ action_parameters?: RouteRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace RouteRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Rewrite the HTTP Host header. */ host_header?: string; /** * Override the IP/TCP destination. */ origin?: ActionParameters.Origin; /** * Override the Server Name Indication (SNI). */ sni?: ActionParameters.Sni; } namespace ActionParameters { /** * Override the IP/TCP destination. */ interface Origin { /** * Override the resolved hostname. */ host?: string; /** * Override the destination port. */ port?: number; } /** * Override the Server Name Indication (SNI). */ interface Sni { /** * The SNI override. */ value: string; } } } export interface RulesetRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 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; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export interface ScoreRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'score'; /** * The parameters configuring the rule's action. */ action_parameters?: ScoreRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace ScoreRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Increment contains the delta to change the score and can be either positive or * negative. */ increment?: number; } } export interface ServeErrorRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'serve_error'; /** * The parameters configuring the rule's action. */ action_parameters?: ServeErrorRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace ServeErrorRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Error response content. */ content?: string; /** * Content-type header to set with the response. */ content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; /** * The status code to use for the error. */ status_code?: number; } } export interface SetCacheSettingsRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'set_cache_settings'; /** * The parameters configuring the rule's action. */ action_parameters?: SetCacheSettingsRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace SetCacheSettingsRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * List of additional ports that caching can be enabled on. */ additional_cacheable_ports?: Array<number>; /** * Specify how long client browsers should cache the response. Cloudflare cache * purge will not purge content cached on client browsers, so high browser TTLs may * lead to stale content. */ browser_ttl?: ActionParameters.BrowserTTL; /** * Mark whether the request’s response from origin is eligible for caching. Caching * itself will still depend on the cache-control header and your other caching * configurations. */ cache?: boolean; /** * Define which components of the request are included or excluded from the cache * key Cloudflare uses to store the response in cache. */ cache_key?: ActionParameters.CacheKey; /** * Mark whether the request's response from origin is eligible for Cache Reserve * (requires a Cache Reserve add-on plan). */ cache_reserve?: ActionParameters.CacheReserve; /** * TTL (Time to Live) specifies the maximum time to cache a resource in the * Cloudflare edge network. */ edge_ttl?: ActionParameters.EdgeTTL; /** * When enabled, Cloudflare will aim to strictly adhere to RFC 7234. */ origin_cache_control?: boolean; /** * Generate Cloudflare error pages from issues sent from the origin server. When * on, error pages will trigger for issues from the origin */ origin_error_page_passthru?: boolean; /** * Define a timeout value between two successive read operations to your origin * server. Historically, the timeout value between two read options from Cloudflare * to an origin server is 100 seconds. If you are attempting to reduce HTTP 524 * errors because of timeouts from an origin server, try increasing this timeout * value. */ read_timeout?: number; /** * Specify whether or not Cloudflare should respect strong ETag (entity tag) * headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. */ respect_strong_etags?: boolean; /** * Define if Cloudflare should serve stale content while getting the latest content * from the origin. If on, Cloudflare will not serve stale content while getting * the latest content from the origin. */ serve_stale?: ActionParameters.ServeStale; } namespace ActionParameters { /** * Specify how long client browsers should cache the response. Cloudflare cache * purge will not purge content cached on client browsers, so high browser TTLs may * lead to stale content. */ interface BrowserTTL { /** * Determines which browser ttl mode to use. */ mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; /** * The TTL (in seconds) if you choose override_origin mode. */ default?: number; } /** * Define which components of the request are included or excluded from the cache * key Cloudflare uses to store the response in cache. */ interface CacheKey { /** * Separate cached content based on the visitor’s device type */ cache_by_device_type?: boolean; /** * Protect from web cache deception attacks while allowing static assets to be * cached */ cache_deception_armor?: boolean; /** * Customize which components of the request are included or excluded from the * cache key. */ custom_key?: CacheKey.CustomKey; /** * Treat requests with the same query parameters the same, regardless of the order * those query parameters are in. A value of true ignores the query strings' order. */ ignore_query_strings_order?: boolean; } namespace CacheKey { /** * Customize which components of the request are included or excluded from the * cache key. */ interface CustomKey { /** * The cookies to include in building the cache key. */ cookie?: CustomKey.Cookie; /** * The header names and values to include in building the cache key. */ header?: CustomKey.Header; /** * Whether to use the original host or the resolved host in the cache key. */ host?: CustomKey.Host; /** * Use the presence or absence of parameters in the query string to build the cache * key. */ query_string?: CustomKey.QueryString; /** * Characteristics of the request user agent used in building the cache key. */ user?: CustomKey.User; } namespace CustomKey { /** * The cookies to include in building the cache key. */ interface Cookie { /** * Checks for the presence of these cookie names. The presence of these cookies is * used in building the cache key. */ check_presence?: Array<string>; /** * Include these cookies' names and their values. */ include?: Array<string>; } /** * The header names and values to include in building the cache key. */ interface Header { /** * Checks for the presence of these header names. The presence of these headers is * used in building the cache key. */ check_presence?: Array<string>; /** * Whether or not to include the origin header. A value of true will exclude the * origin header in the cache key. */ exclude_origin?: boolean; /** * Include these headers' names and their values. */ include?: Array<string>; } /** * Whether to use the original host or the resolved host in the cache key. */ interface Host { /** * Use the resolved host in the cache key. A value of true will use the resolved * host, while a value or false will use the original host. */ resolved?: boolean; } /** * Use the presence or absence of parameters in the query string to build the cache * key. */ interface QueryString { /** * build the cache key using all query string parameters EXCECPT these excluded * parameters */ exclude?: QueryString.Exclude; /** * build the cache key using a list of query string parameters that ARE in the * request. */ include?: QueryString.Include; } namespace QueryString { /** * build the cache key using all query string parameters EXCECPT these excluded * parameters */ interface Exclude { /** * Exclude all query string parameters from use in building the cache key. */ all?: boolean; /** * A list of query string parameters NOT used to build the cache key. All * parameters present in the request but missing in this list will be used to build * the cache key. */ list?: Array<string>; } /** * build the cache key using a list of query string parameters that ARE in the * request. */ interface Include { /** * Use all query string parameters in the cache key. */ all?: boolean; /** * A list of query string parameters used to build the cache key. */ list?: Array<string>; } } /** * Characteristics of the request user agent used in building the cache key. */ interface User { /** * Use the user agent's device type in the cache key. */ device_type?: boolean; /** * Use the user agents's country in the cache key. */ geo?: boolean; /** * Use the user agent's language in the cache key. */ lang?: boolean; } } } /** * Mark whether the request's response from origin is eligible for Cache Reserve * (requires a Cache Reserve add-on plan). */ interface CacheReserve { /** * Determines whether cache reserve is enabled. If this is true and a request meets * eligibility criteria, Cloudflare will write the resource to cache reserve. */ eligible: boolean; /** * The minimum file size eligible for store in cache reserve. */ min_file_size: number; } /** * TTL (Time to Live) specifies the maximum time to cache a resource in the * Cloudflare edge network. */ interface EdgeTTL { /** * The TTL (in seconds) if you choose override_origin mode. */ default: number; /** * edge ttl options */ mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; /** * List of single status codes, or status code ranges to apply the selected mode */ status_code_ttl: Array<EdgeTTL.StatusCodeTTL>; } namespace EdgeTTL { /** * Specify how long Cloudflare should cache the response based on the status code * from the origin. Can be a single status code or a range or status codes */ interface StatusCodeTTL { /** * Time to cache a response (in seconds). A value of 0 is equivalent to setting the * Cache-Control header with the value "no-cache". A value of -1 is equivalent to * setting Cache-Control header with the value of "no-store". */ value: number; /** * The range of status codes used to apply the selected mode. */ status_code_range?: StatusCodeTTL.StatusCodeRange; /** * Set the ttl for responses with this specific status code */ status_code_value?: number; } namespace StatusCodeTTL { /** * The range of status codes used to apply the selected mode. */ interface StatusCodeRange { /** * response status code lower bound */ from: number; /** * response status code upper bound */ to: number; } } } /** * Define if Cloudflare should serve stale content while getting the latest content * from the origin. If on, Cloudflare will not serve stale content while getting * the latest content from the origin. */ interface ServeStale { /** * Defines whether Cloudflare should serve stale content while updating. If true, * Cloudflare will not serve stale content while getting the latest content from * the origin. */ disable_stale_while_updating: boolean; } } } export interface SetConfigRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'set_config'; /** * The parameters configuring the rule's action. */ action_parameters?: SetConfigRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace SetConfigRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * Turn on or off Automatic HTTPS Rewrites. */ automatic_https_rewrites?: boolean; /** * Select which file extensions to minify automatically. */ autominify?: ActionParameters.Autominify; /** * Turn on or off Browser Integrity Check. */ bic?: boolean; /** * Turn off all active Cloudflare Apps. */ disable_apps?: boolean; /** * Turn off Zaraz. */ disable_zaraz?: boolean; /** * Turn on or off Email Obfuscation. */ email_obfuscation?: boolean; /** * Turn on or off the Hotlink Protection. */ hotlink_protection?: boolean; /** * Turn on or off Mirage. */ mirage?: boolean; /** * Turn on or off Opportunistic Encryption. */ opportunistic_encryption?: boolean; /** * Configure the Polish level. */ polish?: 'off' | 'lossless' | 'lossy'; /** * Turn on or off Rocket Loader */ rocket_loader?: boolean; /** * Configure the Security Level. */ security_level?: 'off' | 'essentially_off' | 'low' | 'medium' | 'high' | 'under_attack'; /** * Turn on or off Server Side Excludes. */ server_side_excludes?: boolean; /** * Configure the SSL level. */ ssl?: 'off' | 'flexible' | 'full' | 'strict' | 'origin_pull'; /** * Turn on or off Signed Exchanges (SXG). */ sxg?: boolean; } namespace ActionParameters { /** * Select which file extensions to minify automatically. */ interface Autominify { /** * Minify CSS files. */ css?: boolean; /** * Minify HTML files. */ html?: boolean; /** * Minify JS files. */ js?: boolean; } } } export interface SkipRule { /** * The timestamp of when the rule was last modified. */ last_updated: string; /** * The version of the rule. */ version: string; /** * The unique ID of the rule. */ id?: string; /** * The action to perform when the rule matches. */ action?: 'skip'; /** * The parameters configuring the rule's action. */ action_parameters?: SkipRule.ActionParameters; /** * The categories of the rule. */ categories?: Array<string>; /** * An informative description of the rule. */ description?: string; /** * Whether the rule should be executed. */ enabled?: boolean; /** * The expression defining which traffic will match the rule. */ expression?: string; /** * An object configuring the rule's logging behavior. */ logging?: Logging; /** * The reference of the rule (the rule ID by default). */ ref?: string; } export declare namespace SkipRule { /** * The parameters configuring the rule's action. */ interface ActionParameters { /** * A list of phases to skip the execution of. This option is incompatible with the * ruleset and rulesets options. */ phases?: Array<'ddos_l4' | 'ddos_l7' | 'http_config_settings' | 'http_custom_errors' | 'http_log_custom_fields' | 'http_ratelimit' | 'http_request_cache_settings' | 'http_request_dynamic_redirect' | 'http_request_firewall_custom' | 'http_request_firewall_managed' | 'http_request_late_transform' | 'http_request_origin' | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' | 'http_request_select_configuration' | 'http_request_transform' | 'http_response_compression' | 'http_response_firewall_managed' | 'http_response_headers_transform' | 'magic_transit' | 'magic_transit_ids_managed' | 'magic_transit_managed'>; /** * A list of legacy security products to skip the execution of. */ products?: Array<'bic' | 'hot' | 'rateLimit' | 'securityLevel' | 'uaBlock' | 'waf' | 'zoneLockdown'>; /** * A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the * execution of. This option is incompatible with the ruleset option. */ rules?: Record<string, Array<string>>; /** * A ruleset to skip the execution of. This option is incompatible with the * rulesets, rules and phases options. */ ruleset?: 'current'; /** * A list of ruleset IDs to skip the execution of. This option is incompatible with * the ruleset and phases options. */ rulesets?: Array<string>; } } /** * A ruleset object. */ export interface RuleCreateResponse { /** * The unique ID of the ruleset. */ id: string; /** * The kind of the ruleset. */ kind: 'managed' | 'custom' | 'root' | 'zone'; /** * 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: 'ddos_l4' | 'ddos_l7' | 'http_config_settings' | 'http_custom_errors' | 'http_log_custom_fields' | 'http_ratelimit' | 'http_request_cache_settings' | 'http_request_dynamic_redirect' | 'http_request_firewall_custom' | 'http_request_firewall_managed' | 'http_request_late_transform' | 'http_request_origin' | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' | 'http_request_select_configuration' | 'http_request_transform' | 'http_response_compression' | 'http_response_firewall_managed' | 'http_response_headers_transform' | 'magic_transit' | 'magic_transit_ids_managed' | 'magic_transit_managed'; /** * The list of rules in the ruleset. */ rules: Array<BlockRule | ChallengeRule | CompressResponseRule | ExecuteRule | JSChallengeRule | LogRule | ManagedChallengeRule | RedirectRule | RewriteRule | RouteRule | ScoreRule | ServeErrorRule | SetConfigRule | SkipRule | SetCacheSettingsRule>; /** * The version of the ruleset. */ version: string; /** * An informative description of the ruleset. */ description?: string; } /** * A ruleset object. */ export interface RuleDeleteResponse { /** * The unique ID of the ruleset. */ id: string; /** * The kind of the ruleset. */ kind: 'managed' | 'custom' | 'root' | 'zone'; /** * 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: 'ddos_l4' | 'ddos_l7' | 'http_config_settings' | 'http_custom_errors' | 'http_log_custom_fields' | 'http_ratelimit' | 'http_request_cache_settings' | 'http_request_dynamic_redirect' | 'http_request_firewall_custom' | 'http_request_firewall_managed' | 'http_request_late_transform' | 'http_request_origin' | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' | 'http_request_select_configuration' | 'http_request_transform' | 'http_response_compression' | 'http_response_firewall_managed' | 'http_response_headers_transform' | 'magic_transit' | 'magic_transit_ids_managed' | 'magic_transit_managed'; /** * The list of rules in the ruleset. */ rules: Array<BlockRule | ChallengeRule | CompressResponseRule | ExecuteRule | JSChallengeRule | LogRule | ManagedChallengeRule | RedirectRule | RewriteRule | RouteRule | ScoreRule | ServeErrorRule | SetConfigRule | SkipRule | SetCacheSettingsRule>; /** * The version of the ruleset. */ version: string; /** * An informative description of the ruleset. */ description?: string; } /** * A ruleset object. */ export interface RuleEditResponse { /** * The unique ID of the ruleset. */ id: string; /** * The kind of the ruleset. */ kind: 'managed' | 'custom' | 'root' | 'zone'; /** * 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: 'ddos_l4' | 'ddos_l7' | 'http_config_settings' | 'http_custom_errors' | 'http_log_custom_fields' | 'http_ratelimit' | 'http_request_cache_settings' | 'http_request_dynamic_redirect' | 'http_request_firewall_custom' | 'http_request_firewall_managed' | 'http_request_late_transform' | 'http_request_origin' | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' | 'http_request_select_configuration' | 'http_request_transform' | 'http_respon