diff --git a/.stats.yml b/.stats.yml index 0818ecbb82..d0e375fdcb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1251 +configured_endpoints: 1256 diff --git a/api.md b/api.md index 33822d6845..822f760c9e 100644 --- a/api.md +++ b/api.md @@ -1733,7 +1733,6 @@ Methods: Types: -- Hostname - KeylessCertificate - Tunnel - KeylessCertificateDeleteResponse @@ -1906,7 +1905,6 @@ Methods: Types: - AuthenticatedOriginPull -- ID - HostnameUpdateResponse Methods: @@ -2633,10 +2631,22 @@ Methods: Types: - BlockRule +- ChallengeRule +- CompressResponseRule - ExecuteRule +- JsChallengeRule - LogRule - Logging +- ManagedChallengeRule +- RedirectRule +- RewriteRule +- RewriteURIPart +- RouteRule - RulesetRule +- ScoreRule +- ServeErrorRule +- SetCacheSettingsRule +- SetConfigRule - SkipRule - RuleCreateResponse - RuleDeleteResponse @@ -4067,6 +4077,32 @@ Methods: - client.workersForPlatforms.dispatch.namespaces.scripts.bindings.get(dispatchNamespace, scriptName, { ...params }) -> BindingGetResponse +##### Secrets + +Types: + +- SecretUpdateResponse +- SecretListResponse + +Methods: + +- client.workersForPlatforms.dispatch.namespaces.scripts.secrets.update(dispatchNamespace, scriptName, { ...params }) -> SecretUpdateResponse +- client.workersForPlatforms.dispatch.namespaces.scripts.secrets.list(dispatchNamespace, scriptName, { ...params }) -> SecretListResponsesSinglePage + +##### Tags + +Types: + +- TagUpdateResponse +- TagListResponse +- TagDeleteResponse + +Methods: + +- client.workersForPlatforms.dispatch.namespaces.scripts.tags.update(dispatchNamespace, scriptName, [ ...body ]) -> TagUpdateResponse +- client.workersForPlatforms.dispatch.namespaces.scripts.tags.list(dispatchNamespace, scriptName, { ...params }) -> TagListResponsesSinglePage +- client.workersForPlatforms.dispatch.namespaces.scripts.tags.delete(dispatchNamespace, scriptName, tag, { ...params }) -> TagDeleteResponse | null + # ZeroTrust ## Devices diff --git a/src/resources/keyless-certificates.ts b/src/resources/keyless-certificates.ts index 9345c666ef..ee8f8f436a 100644 --- a/src/resources/keyless-certificates.ts +++ b/src/resources/keyless-certificates.ts @@ -91,60 +91,6 @@ export class KeylessCertificates extends APIResource { export class KeylessCertificatesSinglePage extends SinglePage {} -export interface Hostname { - /** - * Keyless certificate identifier tag. - */ - id: string; - - /** - * When the Keyless SSL was created. - */ - created_on: string; - - /** - * Whether or not the Keyless SSL is on or off. - */ - enabled: boolean; - - /** - * The keyless SSL name. - */ - host: string; - - /** - * When the Keyless SSL was last modified. - */ - modified_on: string; - - /** - * The keyless SSL name. - */ - name: string; - - /** - * Available permissions for the Keyless SSL for the current user requesting the - * item. - */ - permissions: Array; - - /** - * The keyless SSL port used to communicate between Cloudflare and the client's - * Keyless SSL server. - */ - port: number; - - /** - * Status of the Keyless SSL. - */ - status: 'active' | 'deleted'; - - /** - * Configuration for using Keyless SSL through a Cloudflare Tunnel - */ - tunnel?: Tunnel; -} - export interface KeylessCertificate { /** * Keyless certificate identifier tag. diff --git a/src/resources/origin-tls-client-auth/hostnames/hostnames.ts b/src/resources/origin-tls-client-auth/hostnames/hostnames.ts index c938a00e33..6063268c81 100644 --- a/src/resources/origin-tls-client-auth/hostnames/hostnames.ts +++ b/src/resources/origin-tls-client-auth/hostnames/hostnames.ts @@ -137,94 +137,6 @@ export interface AuthenticatedOriginPull { updated_at?: string; } -export interface ID { - /** - * Identifier - */ - cert_id?: string; - - /** - * Status of the certificate or the association. - */ - cert_status?: - | 'initializing' - | 'pending_deployment' - | 'pending_deletion' - | 'active' - | 'deleted' - | 'deployment_timed_out' - | 'deletion_timed_out'; - - /** - * The time when the certificate was updated. - */ - cert_updated_at?: string; - - /** - * The time when the certificate was uploaded. - */ - cert_uploaded_on?: string; - - /** - * The hostname certificate. - */ - certificate?: string; - - /** - * The time when the certificate was created. - */ - created_at?: string; - - /** - * Indicates whether hostname-level authenticated origin pulls is enabled. A null - * value voids the association. - */ - enabled?: boolean | null; - - /** - * The date when the certificate expires. - */ - expires_on?: string; - - /** - * The hostname on the origin for which the client certificate uploaded will be - * used. - */ - hostname?: string; - - /** - * The certificate authority that issued the certificate. - */ - issuer?: string; - - /** - * The serial number on the uploaded certificate. - */ - serial_number?: string; - - /** - * The type of hash used for the certificate. - */ - signature?: string; - - /** - * Status of the certificate or the association. - */ - status?: - | 'initializing' - | 'pending_deployment' - | 'pending_deletion' - | 'active' - | 'deleted' - | 'deployment_timed_out' - | 'deletion_timed_out'; - - /** - * The time when the certificate was updated. - */ - updated_at?: string; -} - export type HostnameUpdateResponse = Array; export interface HostnameUpdateParams { @@ -269,7 +181,6 @@ export interface HostnameGetParams { export namespace Hostnames { export import AuthenticatedOriginPull = HostnamesAPI.AuthenticatedOriginPull; - export import ID = HostnamesAPI.ID; export import HostnameUpdateResponse = HostnamesAPI.HostnameUpdateResponse; export import HostnameUpdateParams = HostnamesAPI.HostnameUpdateParams; export import HostnameGetParams = HostnamesAPI.HostnameGetParams; diff --git a/src/resources/origin-tls-client-auth/hostnames/index.ts b/src/resources/origin-tls-client-auth/hostnames/index.ts index d88d43504b..94a2484f02 100644 --- a/src/resources/origin-tls-client-auth/hostnames/index.ts +++ b/src/resources/origin-tls-client-auth/hostnames/index.ts @@ -2,7 +2,6 @@ export { AuthenticatedOriginPull, - ID, HostnameUpdateResponse, HostnameUpdateParams, HostnameGetParams, diff --git a/src/resources/origin-tls-client-auth/index.ts b/src/resources/origin-tls-client-auth/index.ts index 7ffb41dfdd..5a4d6f8bd9 100644 --- a/src/resources/origin-tls-client-auth/index.ts +++ b/src/resources/origin-tls-client-auth/index.ts @@ -2,7 +2,6 @@ export { AuthenticatedOriginPull, - ID, HostnameUpdateResponse, HostnameUpdateParams, HostnameGetParams, diff --git a/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts b/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts index 9638300cf6..377b542715 100644 --- a/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts +++ b/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts @@ -177,7 +177,6 @@ export interface OriginTLSClientAuthGetParams { export namespace OriginTLSClientAuth { export import Hostnames = HostnamesAPI.Hostnames; export import AuthenticatedOriginPull = HostnamesAPI.AuthenticatedOriginPull; - export import ID = HostnamesAPI.ID; export import HostnameUpdateResponse = HostnamesAPI.HostnameUpdateResponse; export import HostnameUpdateParams = HostnamesAPI.HostnameUpdateParams; export import HostnameGetParams = HostnamesAPI.HostnameGetParams; diff --git a/src/resources/rulesets/index.ts b/src/resources/rulesets/index.ts index 2de9588369..c8367c4fff 100644 --- a/src/resources/rulesets/index.ts +++ b/src/resources/rulesets/index.ts @@ -2,10 +2,22 @@ export { BlockRule, + ChallengeRule, + CompressResponseRule, ExecuteRule, + JsChallengeRule, LogRule, Logging, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RewriteURIPart, + RouteRule, RulesetRule, + ScoreRule, + ServeErrorRule, + SetCacheSettingsRule, + SetConfigRule, SkipRule, RuleCreateResponse, RuleDeleteResponse, diff --git a/src/resources/rulesets/phases/phases.ts b/src/resources/rulesets/phases/phases.ts index a414f9ef72..20958930be 100644 --- a/src/resources/rulesets/phases/phases.ts +++ b/src/resources/rulesets/phases/phases.ts @@ -240,20 +240,20 @@ export interface PhaseUpdateResponse { */ rules: Array< | RulesAPI.BlockRule - | PhaseUpdateResponse.RulesetsChallengeRule - | PhaseUpdateResponse.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | PhaseUpdateResponse.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | PhaseUpdateResponse.RulesetsManagedChallengeRule - | PhaseUpdateResponse.RulesetsRedirectRule - | PhaseUpdateResponse.RulesetsRewriteRule - | PhaseUpdateResponse.RulesetsRouteRule - | PhaseUpdateResponse.RulesetsScoreRule - | PhaseUpdateResponse.RulesetsServeErrorRule - | PhaseUpdateResponse.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | PhaseUpdateResponse.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -267,2862 +267,88 @@ export interface PhaseUpdateResponse { description?: string; } -export namespace PhaseUpdateResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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; - } - } - } -} - -/** - * A ruleset object. - */ -export interface PhaseGetResponse { - /** - * 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< - | RulesAPI.BlockRule - | PhaseGetResponse.RulesetsChallengeRule - | PhaseGetResponse.RulesetsCompressResponseRule - | RulesAPI.ExecuteRule - | PhaseGetResponse.RulesetsJsChallengeRule - | RulesAPI.LogRule - | PhaseGetResponse.RulesetsManagedChallengeRule - | PhaseGetResponse.RulesetsRedirectRule - | PhaseGetResponse.RulesetsRewriteRule - | PhaseGetResponse.RulesetsRouteRule - | PhaseGetResponse.RulesetsScoreRule - | PhaseGetResponse.RulesetsServeErrorRule - | PhaseGetResponse.RulesetsSetConfigRule - | RulesAPI.SkipRule - | PhaseGetResponse.RulesetsSetCacheSettingsRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace PhaseGetResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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'; +/** + * A ruleset object. + */ +export interface PhaseGetResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * List of single status codes, or status code ranges to apply the selected mode - */ - status_code_ttl: Array; - } + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - export 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 - */ - export 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 timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * The range of status codes used to apply the selected mode. - */ - status_code_range?: StatusCodeTTL.StatusCodeRange; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * Set the ttl for responses with this specific status code - */ - status_code_value?: number; - } + /** + * 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'; - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export interface StatusCodeRange { - /** - * response status code lower bound - */ - from: number; + /** + * The list of rules in the ruleset. + */ + rules: Array< + | RulesAPI.BlockRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule + | RulesAPI.ExecuteRule + | RulesAPI.JsChallengeRule + | RulesAPI.LogRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule + | RulesAPI.SkipRule + | RulesAPI.SetCacheSettingsRule + >; - /** - * response status code upper bound - */ - to: number; - } - } - } + /** + * The version of the ruleset. + */ + version: string; - /** - * 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. - */ - export 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; - } - } - } + /** + * An informative description of the ruleset. + */ + description?: string; } export interface PhaseUpdateParams { @@ -3131,20 +357,20 @@ export interface PhaseUpdateParams { */ rules: Array< | RulesAPI.BlockRule - | PhaseUpdateParams.RulesetsChallengeRule - | PhaseUpdateParams.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | PhaseUpdateParams.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | PhaseUpdateParams.RulesetsManagedChallengeRule - | PhaseUpdateParams.RulesetsRedirectRule - | PhaseUpdateParams.RulesetsRewriteRule - | PhaseUpdateParams.RulesetsRouteRule - | PhaseUpdateParams.RulesetsScoreRule - | PhaseUpdateParams.RulesetsServeErrorRule - | PhaseUpdateParams.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | PhaseUpdateParams.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -3203,1228 +429,6 @@ export interface PhaseUpdateParams { | 'magic_transit_managed'; } -export namespace PhaseUpdateParams { - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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 PhaseGetParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. diff --git a/src/resources/rulesets/phases/versions.ts b/src/resources/rulesets/phases/versions.ts index 50bd405e0c..d0eb751821 100644 --- a/src/resources/rulesets/phases/versions.ts +++ b/src/resources/rulesets/phases/versions.ts @@ -298,20 +298,20 @@ export interface VersionGetResponse { */ rules: Array< | RulesAPI.BlockRule - | VersionGetResponse.RulesetsChallengeRule - | VersionGetResponse.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | VersionGetResponse.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | VersionGetResponse.RulesetsManagedChallengeRule - | VersionGetResponse.RulesetsRedirectRule - | VersionGetResponse.RulesetsRewriteRule - | VersionGetResponse.RulesetsRouteRule - | VersionGetResponse.RulesetsScoreRule - | VersionGetResponse.RulesetsServeErrorRule - | VersionGetResponse.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | VersionGetResponse.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -325,1393 +325,6 @@ export interface VersionGetResponse { description?: string; } -export namespace VersionGetResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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 VersionListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. diff --git a/src/resources/rulesets/rules.ts b/src/resources/rulesets/rules.ts index e1b219924f..587eb25acb 100644 --- a/src/resources/rulesets/rules.ts +++ b/src/resources/rulesets/rules.ts @@ -215,6 +215,144 @@ export namespace BlockRule { } } +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; + + /** + * 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; + + /** + * 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 namespace CompressResponseRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * Custom order for compression algorithms. + */ + algorithms?: Array; + } + + export namespace ActionParameters { + /** + * Compression algorithm to enable. + */ + export 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. @@ -397,6 +535,63 @@ export namespace ExecuteRule { } } +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; + + /** + * 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. @@ -464,7 +659,7 @@ export interface Logging { enabled: boolean; } -export interface RulesetRule { +export interface ManagedChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -483,7 +678,7 @@ export interface RulesetRule { /** * The action to perform when the rule matches. */ - action?: string; + action?: 'managed_challenge'; /** * The parameters configuring the rule's action. @@ -521,7 +716,7 @@ export interface RulesetRule { ref?: string; } -export interface SkipRule { +export interface RedirectRule { /** * The timestamp of when the rule was last modified. */ @@ -540,12 +735,12 @@ export interface SkipRule { /** * The action to perform when the rule matches. */ - action?: 'skip'; + action?: 'redirect'; /** * The parameters configuring the rule's action. */ - action_parameters?: SkipRule.ActionParameters; + action_parameters?: RedirectRule.ActionParameters; /** * The categories of the rule. @@ -578,4495 +773,1512 @@ export interface SkipRule { ref?: string; } -export namespace SkipRule { +export namespace RedirectRule { /** * The parameters configuring the rule's action. */ export interface ActionParameters { /** - * A list of phases to skip the execution of. This option is incompatible with the - * ruleset and rulesets options. + * Serve a redirect based on a bulk list lookup. */ - 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' - >; + from_list?: ActionParameters.FromList; /** - * A list of legacy security products to skip the execution of. + * Serve a redirect based on the request properties. */ - products?: Array<'bic' | 'hot' | 'rateLimit' | 'securityLevel' | 'uaBlock' | 'waf' | 'zoneLockdown'>; + from_value?: ActionParameters.FromValue; + } + export namespace ActionParameters { /** - * 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. + * Serve a redirect based on a bulk list lookup. */ - rules?: Record>; + export interface FromList { + /** + * Expression that evaluates to the list lookup key. + */ + key?: string; - /** - * A ruleset to skip the execution of. This option is incompatible with the - * rulesets, rules and phases options. - */ - ruleset?: 'current'; + /** + * The name of the list to match against. + */ + name?: string; + } /** - * A list of ruleset IDs to skip the execution of. This option is incompatible with - * the ruleset and phases options. + * Serve a redirect based on the request properties. */ - rulesets?: Array; - } -} + export interface FromValue { + /** + * Keep the query string of the original request. + */ + preserve_query_string?: boolean; -/** - * A ruleset object. - */ -export interface RuleCreateResponse { - /** - * The unique ID of the ruleset. - */ - id: string; + /** + * The status code to be used for the redirect. + */ + status_code?: 301 | 302 | 303 | 307 | 308; - /** - * The kind of the ruleset. - */ - kind: 'managed' | 'custom' | 'root' | 'zone'; + /** + * The URL to redirect the request to. + */ + target_url?: FromValue.StaticURLRedirect | FromValue.DynamicURLRedirect; + } - /** - * The timestamp of when the ruleset was last modified. + export namespace FromValue { + export interface StaticURLRedirect { + /** + * The URL to redirect the request to. + */ + value?: string; + } + + export 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 human-readable name of the ruleset. + * The version of the rule. */ - name: string; + version: string; /** - * The phase of the ruleset. + * The unique ID of the rule. */ - 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'; + id?: string; /** - * The list of rules in the ruleset. + * The action to perform when the rule matches. */ - rules: Array< - | BlockRule - | RuleCreateResponse.RulesetsChallengeRule - | RuleCreateResponse.RulesetsCompressResponseRule - | ExecuteRule - | RuleCreateResponse.RulesetsJsChallengeRule - | LogRule - | RuleCreateResponse.RulesetsManagedChallengeRule - | RuleCreateResponse.RulesetsRedirectRule - | RuleCreateResponse.RulesetsRewriteRule - | RuleCreateResponse.RulesetsRouteRule - | RuleCreateResponse.RulesetsScoreRule - | RuleCreateResponse.RulesetsServeErrorRule - | RuleCreateResponse.RulesetsSetConfigRule - | SkipRule - | RuleCreateResponse.RulesetsSetCacheSettingsRule - >; + action?: 'rewrite'; /** - * The version of the ruleset. + * The parameters configuring the rule's action. */ - version: string; + action_parameters?: RewriteRule.ActionParameters; /** - * An informative description of the ruleset. + * The categories of the rule. + */ + categories?: Array; + + /** + * 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 namespace RuleCreateResponse { - export interface RulesetsChallengeRule { +export namespace RewriteRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The timestamp of when the rule was last modified. + * Map of request headers to modify. */ - last_updated: string; + headers?: Record< + string, + ActionParameters.RemoveHeader | ActionParameters.StaticHeader | ActionParameters.DynamicHeader + >; /** - * The version of the rule. + * URI to rewrite the request to. */ - version: string; + uri?: ActionParameters.URI; + } + export namespace ActionParameters { /** - * The unique ID of the rule. + * Remove the header from the request. */ - id?: string; + export interface RemoveHeader { + operation: 'remove'; + } /** - * The action to perform when the rule matches. + * Set a request header with a static value. */ - action?: 'challenge'; + export interface StaticHeader { + operation: 'set'; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Static value for the header. + */ + value: string; + } /** - * The categories of the rule. + * Set a request header with a dynamic value. */ - categories?: Array; + export interface DynamicHeader { + /** + * Expression for the header value. + */ + expression: string; - /** - * An informative description of the rule. - */ - description?: string; + operation: 'set'; + } /** - * Whether the rule should be executed. + * URI to rewrite the request to. */ - enabled?: boolean; + export interface URI { + /** + * Path portion rewrite. + */ + path?: RulesAPI.RewriteURIPart; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Query portion rewrite. + */ + query?: RulesAPI.RewriteURIPart; + } + } +} - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; +export type RewriteURIPart = RewriteURIPart.StaticValue | RewriteURIPart.DynamicValue; +export namespace RewriteURIPart { + export interface StaticValue { /** - * The reference of the rule (the rule ID by default). + * Predefined replacement value. */ - ref?: string; + value: string; } - export interface RulesetsCompressResponseRule { + export interface DynamicValue { /** - * The timestamp of when the rule was last modified. + * Expression to evaluate for the replacement value. */ - last_updated: string; + expression: string; + } +} - /** - * The version of the rule. - */ - version: string; +export interface RouteRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * The version of the rule. + */ + version: string; - /** - * The action to perform when the rule matches. - */ - action?: 'compress_response'; + /** + * The unique ID of the rule. + */ + id?: string; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: RulesetsCompressResponseRule.ActionParameters; + /** + * The action to perform when the rule matches. + */ + action?: 'route'; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * The parameters configuring the rule's action. + */ + action_parameters?: RouteRule.ActionParameters; - /** - * An informative description of the rule. - */ - description?: string; + /** + * The categories of the rule. + */ + categories?: Array; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * 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 namespace RouteRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The expression defining which traffic will match the rule. + * Rewrite the HTTP Host header. */ - expression?: string; + host_header?: string; /** - * An object configuring the rule's logging behavior. + * Override the IP/TCP destination. */ - logging?: RulesAPI.Logging; + origin?: ActionParameters.Origin; /** - * The reference of the rule (the rule ID by default). + * Override the Server Name Indication (SNI). */ - ref?: string; + sni?: ActionParameters.Sni; } - export namespace RulesetsCompressResponseRule { + export namespace ActionParameters { /** - * The parameters configuring the rule's action. + * Override the IP/TCP destination. */ - export interface ActionParameters { + export interface Origin { /** - * Custom order for compression algorithms. + * Override the resolved hostname. */ - algorithms?: Array; - } + host?: string; - export namespace ActionParameters { /** - * Compression algorithm to enable. + * Override the destination port. */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } + port?: number; } - } - - export interface RulesetsJsChallengeRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; /** - * The version of the rule. + * Override the Server Name Indication (SNI). */ - version: string; + export interface Sni { + /** + * The SNI override. + */ + value: string; + } + } +} - /** - * The unique ID of the rule. - */ - id?: string; +export interface RulesetRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; - /** - * The action to perform when the rule matches. - */ - action?: 'js_challenge'; + /** + * The version of the rule. + */ + version: string; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * The unique ID of the rule. + */ + id?: string; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * The action to perform when the rule matches. + */ + action?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * The parameters configuring the rule's action. + */ + action_parameters?: unknown; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The categories of the rule. + */ + categories?: Array; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * An informative description of the rule. + */ + description?: string; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * 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; + + /** + * 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 namespace ScoreRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The reference of the rule (the rule ID by default). + * Increment contains the delta to change the score and can be either positive or + * negative. */ - ref?: string; + increment?: number; } +} - export interface RulesetsManagedChallengeRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; +export interface ServeErrorRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; - /** - * The version of the rule. - */ - version: string; + /** + * The version of the rule. + */ + version: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * The unique ID of the rule. + */ + id?: string; - /** - * The action to perform when the rule matches. - */ - action?: 'managed_challenge'; + /** + * The action to perform when the rule matches. + */ + action?: 'serve_error'; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * The parameters configuring the rule's action. + */ + action_parameters?: ServeErrorRule.ActionParameters; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * The categories of the rule. + */ + categories?: Array; - /** - * An informative description of the rule. - */ - description?: string; + /** + * An informative description of the rule. + */ + description?: string; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * 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 namespace ServeErrorRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The expression defining which traffic will match the rule. + * Error response content. */ - expression?: string; + content?: string; /** - * An object configuring the rule's logging behavior. + * Content-type header to set with the response. */ - logging?: RulesAPI.Logging; + content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; /** - * The reference of the rule (the rule ID by default). + * The status code to use for the error. */ - ref?: string; + 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; - export interface RulesetsRedirectRule { + /** + * The categories of the rule. + */ + categories?: Array; + + /** + * 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 namespace SetCacheSettingsRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The timestamp of when the rule was last modified. + * List of additional ports that caching can be enabled on. */ - last_updated: string; + additional_cacheable_ports?: Array; /** - * The version of the rule. + * 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. */ - version: string; + browser_ttl?: ActionParameters.BrowserTTL; /** - * The unique ID of the rule. + * 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. */ - id?: string; + cache?: boolean; /** - * The action to perform when the rule matches. + * Define which components of the request are included or excluded from the cache + * key Cloudflare uses to store the response in cache. */ - action?: 'redirect'; + cache_key?: ActionParameters.CacheKey; /** - * The parameters configuring the rule's action. + * Mark whether the request's response from origin is eligible for Cache Reserve + * (requires a Cache Reserve add-on plan). */ - action_parameters?: RulesetsRedirectRule.ActionParameters; + cache_reserve?: ActionParameters.CacheReserve; /** - * The categories of the rule. + * TTL (Time to Live) specifies the maximum time to cache a resource in the + * Cloudflare edge network. */ - categories?: Array; + edge_ttl?: ActionParameters.EdgeTTL; /** - * An informative description of the rule. + * When enabled, Cloudflare will aim to strictly adhere to RFC 7234. */ - description?: string; + origin_cache_control?: boolean; /** - * Whether the rule should be executed. + * Generate Cloudflare error pages from issues sent from the origin server. When + * on, error pages will trigger for issues from the origin */ - enabled?: boolean; + origin_error_page_passthru?: boolean; /** - * The expression defining which traffic will match the rule. + * 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. */ - expression?: string; + read_timeout?: number; /** - * An object configuring the rule's logging behavior. + * Specify whether or not Cloudflare should respect strong ETag (entity tag) + * headers. When off, Cloudflare converts strong ETag headers to weak ETag headers. */ - logging?: RulesAPI.Logging; + respect_strong_etags?: boolean; /** - * The reference of the rule (the rule ID by default). + * 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. */ - ref?: string; + serve_stale?: ActionParameters.ServeStale; } - export namespace RulesetsRedirectRule { + export namespace ActionParameters { /** - * The parameters configuring the rule's action. + * 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. */ - export interface ActionParameters { + export interface BrowserTTL { /** - * Serve a redirect based on a bulk list lookup. + * Determines which browser ttl mode to use. */ - from_list?: ActionParameters.FromList; + mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; /** - * Serve a redirect based on the request properties. + * The TTL (in seconds) if you choose override_origin mode. */ - from_value?: ActionParameters.FromValue; + default?: number; } - export namespace ActionParameters { + /** + * Define which components of the request are included or excluded from the cache + * key Cloudflare uses to store the response in cache. + */ + export interface CacheKey { /** - * Serve a redirect based on a bulk list lookup. + * Separate cached content based on the visitor’s device type */ - export interface FromList { - /** - * Expression that evaluates to the list lookup key. - */ - key?: string; - - /** - * The name of the list to match against. - */ - name?: string; - } + cache_by_device_type?: boolean; /** - * Serve a redirect based on the request properties. + * Protect from web cache deception attacks while allowing static assets to be + * cached */ - export interface FromValue { + 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; + } + + export namespace CacheKey { + /** + * Customize which components of the request are included or excluded from the + * cache key. + */ + export interface CustomKey { /** - * Keep the query string of the original request. + * The cookies to include in building the cache key. */ - preserve_query_string?: boolean; + cookie?: CustomKey.Cookie; /** - * The status code to be used for the redirect. + * The header names and values to include in building the cache key. */ - status_code?: 301 | 302 | 303 | 307 | 308; + header?: CustomKey.Header; /** - * The URL to redirect the request to. + * Whether to use the original host or the resolved host in the cache key. */ - target_url?: FromValue.StaticURLRedirect | FromValue.DynamicURLRedirect; + 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; } - export namespace FromValue { - export interface StaticURLRedirect { + export namespace CustomKey { + /** + * The cookies to include in building the cache key. + */ + export interface Cookie { /** - * The URL to redirect the request to. + * Checks for the presence of these cookie names. The presence of these cookies is + * used in building the cache key. */ - value?: string; - } + check_presence?: Array; - export interface DynamicURLRedirect { /** - * An expression to evaluate to get the URL to redirect the request to. + * Include these cookies' names and their values. */ - expression?: string; + include?: Array; } - } - } - } - export interface RulesetsRewriteRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; + /** + * The header names and values to include in building the cache key. + */ + export 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; - /** - * The version of the rule. - */ - version: 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; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Include these headers' names and their values. + */ + include?: Array; + } - /** - * The action to perform when the rule matches. - */ - action?: 'rewrite'; + /** + * Whether to use the original host or the resolved host in the cache key. + */ + export 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; + } - /** - * The parameters configuring the rule's action. - */ - action_parameters?: RulesetsRewriteRule.ActionParameters; + /** + * Use the presence or absence of parameters in the query string to build the cache + * key. + */ + export interface QueryString { + /** + * build the cache key using all query string parameters EXCECPT these excluded + * parameters + */ + exclude?: QueryString.Exclude; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * build the cache key using a list of query string parameters that ARE in the + * request. + */ + include?: QueryString.Include; + } - /** - * An informative description of the rule. - */ - description?: string; + export namespace QueryString { + /** + * build the cache key using all query string parameters EXCECPT these excluded + * parameters + */ + export interface Exclude { + /** + * Exclude all query string parameters from use in building the cache key. + */ + all?: boolean; - /** - * Whether the rule should be executed. - */ - enabled?: 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; + } - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * build the cache key using a list of query string parameters that ARE in the + * request. + */ + export interface Include { + /** + * Use all query string parameters in the cache key. + */ + all?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * A list of query string parameters used to build the cache key. + */ + list?: Array; + } + } - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } + /** + * Characteristics of the request user agent used in building the cache key. + */ + export 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; + } + } + } - export namespace RulesetsRewriteRule { /** - * The parameters configuring the rule's action. + * Mark whether the request's response from origin is eligible for Cache Reserve + * (requires a Cache Reserve add-on plan). */ - export interface ActionParameters { + export interface CacheReserve { /** - * Map of request headers to modify. + * Determines whether cache reserve is enabled. If this is true and a request meets + * eligibility criteria, Cloudflare will write the resource to cache reserve. */ - headers?: Record< - string, - ActionParameters.RemoveHeader | ActionParameters.StaticHeader | ActionParameters.DynamicHeader - >; + eligible: boolean; /** - * URI to rewrite the request to. + * The minimum file size eligible for store in cache reserve. */ - uri?: ActionParameters.URI; + min_file_size: number; } - export namespace ActionParameters { + /** + * TTL (Time to Live) specifies the maximum time to cache a resource in the + * Cloudflare edge network. + */ + export interface EdgeTTL { /** - * Remove the header from the request. + * The TTL (in seconds) if you choose override_origin mode. */ - export interface RemoveHeader { - operation: 'remove'; - } + default: number; /** - * Set a request header with a static value. + * edge ttl options */ - export interface StaticHeader { - operation: 'set'; + mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; - /** - * Static value for the header. - */ - value: string; - } + /** + * List of single status codes, or status code ranges to apply the selected mode + */ + status_code_ttl: Array; + } + export namespace EdgeTTL { /** - * Set a request header with a dynamic value. + * 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 */ - export interface DynamicHeader { + export interface StatusCodeTTL { /** - * Expression for the header value. + * 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". */ - expression: string; - - operation: 'set'; - } + value: number; - /** - * URI to rewrite the request to. - */ - export interface URI { /** - * Path portion rewrite. + * The range of status codes used to apply the selected mode. */ - path?: URI.StaticValue | URI.DynamicValue; + status_code_range?: StatusCodeTTL.StatusCodeRange; /** - * Query portion rewrite. + * Set the ttl for responses with this specific status code */ - query?: URI.StaticValue | URI.DynamicValue; + status_code_value?: number; } - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { + export namespace StatusCodeTTL { + /** + * The range of status codes used to apply the selected mode. + */ + export interface StatusCodeRange { /** - * Predefined replacement value. + * response status code lower bound */ - value: string; - } + from: number; - export interface DynamicValue { /** - * Expression to evaluate for the replacement value. + * response status code upper bound */ - expression: string; + 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. + */ + export 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; + + /** + * 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 RulesetsRouteRule { +export namespace SetConfigRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The timestamp of when the rule was last modified. + * Turn on or off Automatic HTTPS Rewrites. */ - last_updated: string; + automatic_https_rewrites?: boolean; /** - * The version of the rule. + * Select which file extensions to minify automatically. */ - version: string; + autominify?: ActionParameters.Autominify; /** - * The unique ID of the rule. + * Turn on or off Browser Integrity Check. */ - id?: string; + bic?: boolean; /** - * The action to perform when the rule matches. + * Turn off all active Cloudflare Apps. */ - action?: 'route'; + disable_apps?: boolean; /** - * The parameters configuring the rule's action. + * Turn off Zaraz. */ - action_parameters?: RulesetsRouteRule.ActionParameters; + disable_zaraz?: boolean; /** - * The categories of the rule. + * Turn on or off Email Obfuscation. */ - categories?: Array; + email_obfuscation?: boolean; /** - * An informative description of the rule. + * Turn on or off the Hotlink Protection. */ - description?: string; + hotlink_protection?: boolean; /** - * Whether the rule should be executed. + * Turn on or off Mirage. */ - enabled?: boolean; + mirage?: boolean; /** - * The expression defining which traffic will match the rule. + * Turn on or off Opportunistic Encryption. */ - expression?: string; + opportunistic_encryption?: boolean; /** - * An object configuring the rule's logging behavior. + * Configure the Polish level. */ - logging?: RulesAPI.Logging; + polish?: 'off' | 'lossless' | 'lossy'; /** - * The reference of the rule (the rule ID by default). + * Turn on or off Rocket Loader */ - ref?: string; + 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; } - export namespace RulesetsRouteRule { + export namespace ActionParameters { /** - * The parameters configuring the rule's action. + * Select which file extensions to minify automatically. */ - export interface ActionParameters { + export interface Autominify { /** - * Rewrite the HTTP Host header. + * Minify CSS files. */ - host_header?: string; + css?: boolean; /** - * Override the IP/TCP destination. + * Minify HTML files. */ - origin?: ActionParameters.Origin; + html?: boolean; /** - * Override the Server Name Indication (SNI). + * Minify JS files. */ - sni?: ActionParameters.Sni; + js?: boolean; } + } +} - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; +export interface SkipRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; - /** - * Override the destination port. - */ - port?: number; - } + /** + * The version of the rule. + */ + version: string; - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } + /** + * The unique ID of the rule. + */ + id?: string; - export interface RulesetsScoreRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; + /** + * The action to perform when the rule matches. + */ + action?: 'skip'; - /** - * The version of the rule. - */ - version: string; + /** + * The parameters configuring the rule's action. + */ + action_parameters?: SkipRule.ActionParameters; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * The categories of the rule. + */ + categories?: Array; - /** - * The action to perform when the rule matches. - */ - action?: 'score'; + /** + * An informative description of the rule. + */ + description?: string; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: RulesetsScoreRule.ActionParameters; + /** + * Whether the rule should be executed. + */ + enabled?: boolean; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * The expression defining which traffic will match the rule. + */ + expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * An object configuring the rule's logging behavior. + */ + logging?: Logging; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The reference of the rule (the rule ID by default). + */ + ref?: string; +} +export namespace SkipRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { /** - * The expression defining which traffic will match the rule. + * A list of phases to skip the execution of. This option is incompatible with the + * ruleset and rulesets options. */ - expression?: string; + 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' + >; /** - * An object configuring the rule's logging behavior. + * A list of legacy security products to skip the execution of. */ - logging?: RulesAPI.Logging; + products?: Array<'bic' | 'hot' | 'rateLimit' | 'securityLevel' | 'uaBlock' | 'waf' | 'zoneLockdown'>; /** - * The reference of the rule (the rule ID by default). + * 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. */ - ref?: string; - } + rules?: Record>; - export namespace RulesetsScoreRule { /** - * The parameters configuring the rule's action. + * A ruleset to skip the execution of. This option is incompatible with the + * rulesets, rules and phases options. */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } + ruleset?: 'current'; - export interface RulesetsServeErrorRule { /** - * The timestamp of when the rule was last modified. + * A list of ruleset IDs to skip the execution of. This option is incompatible with + * the ruleset and phases options. */ - last_updated: string; + rulesets?: Array; + } +} - /** - * The version of the rule. - */ - version: string; +/** + * A ruleset object. + */ +export interface RuleCreateResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - /** - * The action to perform when the rule matches. - */ - action?: 'serve_error'; + /** + * The timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: RulesetsServeErrorRule.ActionParameters; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * 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'; - /** - * An informative description of the rule. - */ - description?: string; + /** + * The list of rules in the ruleset. + */ + rules: Array< + | BlockRule + | ChallengeRule + | CompressResponseRule + | ExecuteRule + | JsChallengeRule + | LogRule + | ManagedChallengeRule + | RedirectRule + | RewriteRule + | RouteRule + | ScoreRule + | ServeErrorRule + | SetConfigRule + | SkipRule + | SetCacheSettingsRule + >; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The version of the ruleset. + */ + version: string; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * An informative description of the ruleset. + */ + description?: string; +} - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; +/** + * A ruleset object. + */ +export interface RuleDeleteResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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; - } - } - } -} - -/** - * 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 - | RuleDeleteResponse.RulesetsChallengeRule - | RuleDeleteResponse.RulesetsCompressResponseRule - | ExecuteRule - | RuleDeleteResponse.RulesetsJsChallengeRule - | LogRule - | RuleDeleteResponse.RulesetsManagedChallengeRule - | RuleDeleteResponse.RulesetsRedirectRule - | RuleDeleteResponse.RulesetsRewriteRule - | RuleDeleteResponse.RulesetsRouteRule - | RuleDeleteResponse.RulesetsScoreRule - | RuleDeleteResponse.RulesetsServeErrorRule - | RuleDeleteResponse.RulesetsSetConfigRule - | SkipRule - | RuleDeleteResponse.RulesetsSetCacheSettingsRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace RuleDeleteResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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; - } - } - } -} - -/** - * 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_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 - | RuleEditResponse.RulesetsChallengeRule - | RuleEditResponse.RulesetsCompressResponseRule - | ExecuteRule - | RuleEditResponse.RulesetsJsChallengeRule - | LogRule - | RuleEditResponse.RulesetsManagedChallengeRule - | RuleEditResponse.RulesetsRedirectRule - | RuleEditResponse.RulesetsRewriteRule - | RuleEditResponse.RulesetsRouteRule - | RuleEditResponse.RulesetsScoreRule - | RuleEditResponse.RulesetsServeErrorRule - | RuleEditResponse.RulesetsSetConfigRule - | SkipRule - | RuleEditResponse.RulesetsSetCacheSettingsRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace RuleEditResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - /** - * Characteristics of the request user agent used in building the cache key. - */ - export interface User { - /** - * Use the user agent's device type in the cache key. - */ - device_type?: boolean; + /** + * The timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * Use the user agents's country in the cache key. - */ - geo?: boolean; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * Use the user agent's language in the cache key. - */ - lang?: boolean; - } - } - } + /** + * 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'; - /** - * Mark whether the request's response from origin is eligible for Cache Reserve - * (requires a Cache Reserve add-on plan). - */ - export 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 list of rules in the ruleset. + */ + rules: Array< + | BlockRule + | ChallengeRule + | CompressResponseRule + | ExecuteRule + | JsChallengeRule + | LogRule + | ManagedChallengeRule + | RedirectRule + | RewriteRule + | RouteRule + | ScoreRule + | ServeErrorRule + | SetConfigRule + | SkipRule + | SetCacheSettingsRule + >; - /** - * The minimum file size eligible for store in cache reserve. - */ - min_file_size: number; - } + /** + * The version of the ruleset. + */ + version: string; - /** - * TTL (Time to Live) specifies the maximum time to cache a resource in the - * Cloudflare edge network. - */ - export interface EdgeTTL { - /** - * The TTL (in seconds) if you choose override_origin mode. - */ - default: number; + /** + * An informative description of the ruleset. + */ + description?: string; +} - /** - * edge ttl options - */ - mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; +/** + * A ruleset object. + */ +export interface RuleEditResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * List of single status codes, or status code ranges to apply the selected mode - */ - status_code_ttl: Array; - } + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - export 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 - */ - export 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 timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * The range of status codes used to apply the selected mode. - */ - status_code_range?: StatusCodeTTL.StatusCodeRange; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * Set the ttl for responses with this specific status code - */ - status_code_value?: number; - } + /** + * 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'; - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export interface StatusCodeRange { - /** - * response status code lower bound - */ - from: number; + /** + * The list of rules in the ruleset. + */ + rules: Array< + | BlockRule + | ChallengeRule + | CompressResponseRule + | ExecuteRule + | JsChallengeRule + | LogRule + | ManagedChallengeRule + | RedirectRule + | RewriteRule + | RouteRule + | ScoreRule + | ServeErrorRule + | SetConfigRule + | SkipRule + | SetCacheSettingsRule + >; - /** - * response status code upper bound - */ - to: number; - } - } - } + /** + * The version of the ruleset. + */ + version: string; - /** - * 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. - */ - export 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; - } - } - } + /** + * An informative description of the ruleset. + */ + description?: string; } export type RuleCreateParams = | RuleCreateParams.BlockRule - | RuleCreateParams.RulesetsChallengeRule - | RuleCreateParams.RulesetsCompressResponseRule + | RuleCreateParams.ChallengeRule + | RuleCreateParams.CompressResponseRule | RuleCreateParams.ExecuteRule - | RuleCreateParams.RulesetsJsChallengeRule + | RuleCreateParams.JsChallengeRule | RuleCreateParams.LogRule - | RuleCreateParams.RulesetsManagedChallengeRule - | RuleCreateParams.RulesetsRedirectRule - | RuleCreateParams.RulesetsRewriteRule - | RuleCreateParams.RulesetsRouteRule - | RuleCreateParams.RulesetsScoreRule - | RuleCreateParams.RulesetsServeErrorRule - | RuleCreateParams.RulesetsSetConfigRule + | RuleCreateParams.ManagedChallengeRule + | RuleCreateParams.RedirectRule + | RuleCreateParams.RewriteRule + | RuleCreateParams.RouteRule + | RuleCreateParams.ScoreRule + | RuleCreateParams.ServeErrorRule + | RuleCreateParams.SetConfigRule | RuleCreateParams.SkipRule - | RuleCreateParams.RulesetsSetCacheSettingsRule; + | RuleCreateParams.SetCacheSettingsRule; export namespace RuleCreateParams { export interface BlockRule { @@ -5157,7 +2369,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsChallengeRule { + export interface ChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5211,7 +2423,7 @@ export namespace RuleCreateParams { ref?: string; } - export interface RulesetsCompressResponseRule { + export interface CompressResponseRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5237,7 +2449,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsCompressResponseRule.ActionParameters; + action_parameters?: RuleCreateParams.CompressResponseRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5265,7 +2477,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsCompressResponseRule { + export namespace CompressResponseRule { /** * The parameters configuring the rule's action. */ @@ -5468,7 +2680,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsJsChallengeRule { + export interface JsChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5576,7 +2788,7 @@ export namespace RuleCreateParams { ref?: string; } - export interface RulesetsManagedChallengeRule { + export interface ManagedChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5630,7 +2842,7 @@ export namespace RuleCreateParams { ref?: string; } - export interface RulesetsRedirectRule { + export interface RedirectRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5656,7 +2868,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsRedirectRule.ActionParameters; + action_parameters?: RuleCreateParams.RedirectRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5684,7 +2896,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsRedirectRule { + export namespace RedirectRule { /** * The parameters configuring the rule's action. */ @@ -5754,7 +2966,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsRewriteRule { + export interface RewriteRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5780,7 +2992,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsRewriteRule.ActionParameters; + action_parameters?: RuleCreateParams.RewriteRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5808,7 +3020,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsRewriteRule { + export namespace RewriteRule { /** * The parameters configuring the rule's action. */ @@ -5866,47 +3078,17 @@ export namespace RuleCreateParams { /** * Path portion rewrite. */ - path?: URI.StaticValue | URI.DynamicValue; + path?: RulesAPI.RewriteURIPart; /** * Query portion rewrite. */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } + query?: RulesAPI.RewriteURIPart; } } } - export interface RulesetsRouteRule { + export interface RouteRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5932,7 +3114,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsRouteRule.ActionParameters; + action_parameters?: RuleCreateParams.RouteRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5960,7 +3142,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsRouteRule { + export namespace RouteRule { /** * The parameters configuring the rule's action. */ @@ -6009,7 +3191,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsScoreRule { + export interface ScoreRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6035,7 +3217,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsScoreRule.ActionParameters; + action_parameters?: RuleCreateParams.ScoreRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6063,7 +3245,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsScoreRule { + export namespace ScoreRule { /** * The parameters configuring the rule's action. */ @@ -6076,7 +3258,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsServeErrorRule { + export interface ServeErrorRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6102,7 +3284,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsServeErrorRule.ActionParameters; + action_parameters?: RuleCreateParams.ServeErrorRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6130,7 +3312,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsServeErrorRule { + export namespace ServeErrorRule { /** * The parameters configuring the rule's action. */ @@ -6152,7 +3334,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsSetConfigRule { + export interface SetConfigRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6178,7 +3360,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsSetConfigRule.ActionParameters; + action_parameters?: RuleCreateParams.SetConfigRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6206,7 +3388,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsSetConfigRule { + export namespace SetConfigRule { /** * The parameters configuring the rule's action. */ @@ -6424,7 +3606,7 @@ export namespace RuleCreateParams { } } - export interface RulesetsSetCacheSettingsRule { + export interface SetCacheSettingsRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6450,7 +3632,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsSetCacheSettingsRule.ActionParameters; + action_parameters?: RuleCreateParams.SetCacheSettingsRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6478,7 +3660,7 @@ export namespace RuleCreateParams { ref?: string; } - export namespace RulesetsSetCacheSettingsRule { + export namespace SetCacheSettingsRule { /** * The parameters configuring the rule's action. */ @@ -6871,20 +4053,20 @@ export interface RuleDeleteParams { export type RuleEditParams = | RuleEditParams.BlockRule - | RuleEditParams.RulesetsChallengeRule - | RuleEditParams.RulesetsCompressResponseRule + | RuleEditParams.ChallengeRule + | RuleEditParams.CompressResponseRule | RuleEditParams.ExecuteRule - | RuleEditParams.RulesetsJsChallengeRule + | RuleEditParams.JsChallengeRule | RuleEditParams.LogRule - | RuleEditParams.RulesetsManagedChallengeRule - | RuleEditParams.RulesetsRedirectRule - | RuleEditParams.RulesetsRewriteRule - | RuleEditParams.RulesetsRouteRule - | RuleEditParams.RulesetsScoreRule - | RuleEditParams.RulesetsServeErrorRule - | RuleEditParams.RulesetsSetConfigRule + | RuleEditParams.ManagedChallengeRule + | RuleEditParams.RedirectRule + | RuleEditParams.RewriteRule + | RuleEditParams.RouteRule + | RuleEditParams.ScoreRule + | RuleEditParams.ServeErrorRule + | RuleEditParams.SetConfigRule | RuleEditParams.SkipRule - | RuleEditParams.RulesetsSetCacheSettingsRule; + | RuleEditParams.SetCacheSettingsRule; export namespace RuleEditParams { export interface BlockRule { @@ -6975,7 +4157,7 @@ export namespace RuleEditParams { } } - export interface RulesetsChallengeRule { + export interface ChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7029,7 +4211,7 @@ export namespace RuleEditParams { ref?: string; } - export interface RulesetsCompressResponseRule { + export interface CompressResponseRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7055,7 +4237,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsCompressResponseRule.ActionParameters; + action_parameters?: RuleEditParams.CompressResponseRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7083,7 +4265,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsCompressResponseRule { + export namespace CompressResponseRule { /** * The parameters configuring the rule's action. */ @@ -7286,7 +4468,7 @@ export namespace RuleEditParams { } } - export interface RulesetsJsChallengeRule { + export interface JsChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7394,7 +4576,7 @@ export namespace RuleEditParams { ref?: string; } - export interface RulesetsManagedChallengeRule { + export interface ManagedChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7448,7 +4630,7 @@ export namespace RuleEditParams { ref?: string; } - export interface RulesetsRedirectRule { + export interface RedirectRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7474,7 +4656,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsRedirectRule.ActionParameters; + action_parameters?: RuleEditParams.RedirectRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7502,7 +4684,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsRedirectRule { + export namespace RedirectRule { /** * The parameters configuring the rule's action. */ @@ -7572,7 +4754,7 @@ export namespace RuleEditParams { } } - export interface RulesetsRewriteRule { + export interface RewriteRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7598,7 +4780,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsRewriteRule.ActionParameters; + action_parameters?: RuleEditParams.RewriteRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7626,7 +4808,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsRewriteRule { + export namespace RewriteRule { /** * The parameters configuring the rule's action. */ @@ -7684,47 +4866,17 @@ export namespace RuleEditParams { /** * Path portion rewrite. */ - path?: URI.StaticValue | URI.DynamicValue; + path?: RulesAPI.RewriteURIPart; /** * Query portion rewrite. */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } + query?: RulesAPI.RewriteURIPart; } } } - export interface RulesetsRouteRule { + export interface RouteRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7750,7 +4902,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsRouteRule.ActionParameters; + action_parameters?: RuleEditParams.RouteRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7778,7 +4930,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsRouteRule { + export namespace RouteRule { /** * The parameters configuring the rule's action. */ @@ -7827,7 +4979,7 @@ export namespace RuleEditParams { } } - export interface RulesetsScoreRule { + export interface ScoreRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7853,7 +5005,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsScoreRule.ActionParameters; + action_parameters?: RuleEditParams.ScoreRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7881,7 +5033,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsScoreRule { + export namespace ScoreRule { /** * The parameters configuring the rule's action. */ @@ -7894,7 +5046,7 @@ export namespace RuleEditParams { } } - export interface RulesetsServeErrorRule { + export interface ServeErrorRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7920,7 +5072,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsServeErrorRule.ActionParameters; + action_parameters?: RuleEditParams.ServeErrorRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7948,7 +5100,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsServeErrorRule { + export namespace ServeErrorRule { /** * The parameters configuring the rule's action. */ @@ -7970,7 +5122,7 @@ export namespace RuleEditParams { } } - export interface RulesetsSetConfigRule { + export interface SetConfigRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7996,7 +5148,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsSetConfigRule.ActionParameters; + action_parameters?: RuleEditParams.SetConfigRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -8024,7 +5176,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsSetConfigRule { + export namespace SetConfigRule { /** * The parameters configuring the rule's action. */ @@ -8242,7 +5394,7 @@ export namespace RuleEditParams { } } - export interface RulesetsSetCacheSettingsRule { + export interface SetCacheSettingsRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -8268,7 +5420,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsSetCacheSettingsRule.ActionParameters; + action_parameters?: RuleEditParams.SetCacheSettingsRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -8296,7 +5448,7 @@ export namespace RuleEditParams { ref?: string; } - export namespace RulesetsSetCacheSettingsRule { + export namespace SetCacheSettingsRule { /** * The parameters configuring the rule's action. */ @@ -8677,10 +5829,22 @@ export namespace RuleEditParams { export namespace Rules { export import BlockRule = RulesAPI.BlockRule; + export import ChallengeRule = RulesAPI.ChallengeRule; + export import CompressResponseRule = RulesAPI.CompressResponseRule; export import ExecuteRule = RulesAPI.ExecuteRule; + export import JsChallengeRule = RulesAPI.JsChallengeRule; export import LogRule = RulesAPI.LogRule; export import Logging = RulesAPI.Logging; + export import ManagedChallengeRule = RulesAPI.ManagedChallengeRule; + export import RedirectRule = RulesAPI.RedirectRule; + export import RewriteRule = RulesAPI.RewriteRule; + export import RewriteURIPart = RulesAPI.RewriteURIPart; + export import RouteRule = RulesAPI.RouteRule; export import RulesetRule = RulesAPI.RulesetRule; + export import ScoreRule = RulesAPI.ScoreRule; + export import ServeErrorRule = RulesAPI.ServeErrorRule; + export import SetCacheSettingsRule = RulesAPI.SetCacheSettingsRule; + export import SetConfigRule = RulesAPI.SetConfigRule; export import SkipRule = RulesAPI.SkipRule; export import RuleCreateResponse = RulesAPI.RuleCreateResponse; export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; diff --git a/src/resources/rulesets/rulesets.ts b/src/resources/rulesets/rulesets.ts index 2440f16d45..34caf802f9 100644 --- a/src/resources/rulesets/rulesets.ts +++ b/src/resources/rulesets/rulesets.ts @@ -320,20 +320,20 @@ export interface RulesetCreateResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesetCreateResponse.RulesetsChallengeRule - | RulesetCreateResponse.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesetCreateResponse.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | RulesetCreateResponse.RulesetsManagedChallengeRule - | RulesetCreateResponse.RulesetsRedirectRule - | RulesetCreateResponse.RulesetsRewriteRule - | RulesetCreateResponse.RulesetsRouteRule - | RulesetCreateResponse.RulesetsScoreRule - | RulesetCreateResponse.RulesetsServeErrorRule - | RulesetCreateResponse.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | RulesetCreateResponse.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -347,4333 +347,172 @@ export interface RulesetCreateResponse { description?: string; } -export namespace RulesetCreateResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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; - } - } - } -} - -/** - * A ruleset object. - */ -export interface RulesetUpdateResponse { - /** - * 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< - | RulesAPI.BlockRule - | RulesetUpdateResponse.RulesetsChallengeRule - | RulesetUpdateResponse.RulesetsCompressResponseRule - | RulesAPI.ExecuteRule - | RulesetUpdateResponse.RulesetsJsChallengeRule - | RulesAPI.LogRule - | RulesetUpdateResponse.RulesetsManagedChallengeRule - | RulesetUpdateResponse.RulesetsRedirectRule - | RulesetUpdateResponse.RulesetsRewriteRule - | RulesetUpdateResponse.RulesetsRouteRule - | RulesetUpdateResponse.RulesetsScoreRule - | RulesetUpdateResponse.RulesetsServeErrorRule - | RulesetUpdateResponse.RulesetsSetConfigRule - | RulesAPI.SkipRule - | RulesetUpdateResponse.RulesetsSetCacheSettingsRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace RulesetUpdateResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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; - } - } - } -} - -/** - * A ruleset object. - */ -export interface RulesetGetResponse { - /** - * 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< - | RulesAPI.BlockRule - | RulesetGetResponse.RulesetsChallengeRule - | RulesetGetResponse.RulesetsCompressResponseRule - | RulesAPI.ExecuteRule - | RulesetGetResponse.RulesetsJsChallengeRule - | RulesAPI.LogRule - | RulesetGetResponse.RulesetsManagedChallengeRule - | RulesetGetResponse.RulesetsRedirectRule - | RulesetGetResponse.RulesetsRewriteRule - | RulesetGetResponse.RulesetsRouteRule - | RulesetGetResponse.RulesetsScoreRule - | RulesetGetResponse.RulesetsServeErrorRule - | RulesetGetResponse.RulesetsSetConfigRule - | RulesAPI.SkipRule - | RulesetGetResponse.RulesetsSetCacheSettingsRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace RulesetGetResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export interface Include { - /** - * Use all query string parameters in the cache key. - */ - all?: boolean; +/** + * A ruleset object. + */ +export interface RulesetUpdateResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * A list of query string parameters used to build the cache key. - */ - list?: Array; - } - } + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - /** - * Characteristics of the request user agent used in building the cache key. - */ - export interface User { - /** - * Use the user agent's device type in the cache key. - */ - device_type?: boolean; + /** + * The timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * Use the user agents's country in the cache key. - */ - geo?: boolean; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * Use the user agent's language in the cache key. - */ - lang?: boolean; - } - } - } + /** + * 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'; - /** - * Mark whether the request's response from origin is eligible for Cache Reserve - * (requires a Cache Reserve add-on plan). - */ - export 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 list of rules in the ruleset. + */ + rules: Array< + | RulesAPI.BlockRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule + | RulesAPI.ExecuteRule + | RulesAPI.JsChallengeRule + | RulesAPI.LogRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule + | RulesAPI.SkipRule + | RulesAPI.SetCacheSettingsRule + >; - /** - * The minimum file size eligible for store in cache reserve. - */ - min_file_size: number; - } + /** + * The version of the ruleset. + */ + version: string; - /** - * TTL (Time to Live) specifies the maximum time to cache a resource in the - * Cloudflare edge network. - */ - export interface EdgeTTL { - /** - * The TTL (in seconds) if you choose override_origin mode. - */ - default: number; + /** + * An informative description of the ruleset. + */ + description?: string; +} - /** - * edge ttl options - */ - mode: 'respect_origin' | 'bypass_by_default' | 'override_origin'; +/** + * A ruleset object. + */ +export interface RulesetGetResponse { + /** + * The unique ID of the ruleset. + */ + id: string; - /** - * List of single status codes, or status code ranges to apply the selected mode - */ - status_code_ttl: Array; - } + /** + * The kind of the ruleset. + */ + kind: 'managed' | 'custom' | 'root' | 'zone'; - export 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 - */ - export 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 timestamp of when the ruleset was last modified. + */ + last_updated: string; - /** - * The range of status codes used to apply the selected mode. - */ - status_code_range?: StatusCodeTTL.StatusCodeRange; + /** + * The human-readable name of the ruleset. + */ + name: string; - /** - * Set the ttl for responses with this specific status code - */ - status_code_value?: number; - } + /** + * 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'; - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export interface StatusCodeRange { - /** - * response status code lower bound - */ - from: number; + /** + * The list of rules in the ruleset. + */ + rules: Array< + | RulesAPI.BlockRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule + | RulesAPI.ExecuteRule + | RulesAPI.JsChallengeRule + | RulesAPI.LogRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule + | RulesAPI.SkipRule + | RulesAPI.SetCacheSettingsRule + >; - /** - * response status code upper bound - */ - to: number; - } - } - } + /** + * The version of the ruleset. + */ + version: string; - /** - * 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. - */ - export 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; - } - } - } + /** + * An informative description of the ruleset. + */ + description?: string; } export interface RulesetCreateParams { @@ -4717,1263 +556,41 @@ export interface RulesetCreateParams { /** * Body param: The list of rules in the ruleset. - */ - rules: Array< - | RulesAPI.BlockRule - | RulesetCreateParams.RulesetsChallengeRule - | RulesetCreateParams.RulesetsCompressResponseRule - | RulesAPI.ExecuteRule - | RulesetCreateParams.RulesetsJsChallengeRule - | RulesAPI.LogRule - | RulesetCreateParams.RulesetsManagedChallengeRule - | RulesetCreateParams.RulesetsRedirectRule - | RulesetCreateParams.RulesetsRewriteRule - | RulesetCreateParams.RulesetsRouteRule - | RulesetCreateParams.RulesetsScoreRule - | RulesetCreateParams.RulesetsServeErrorRule - | RulesetCreateParams.RulesetsSetConfigRule - | RulesAPI.SkipRule - | RulesetCreateParams.RulesetsSetCacheSettingsRule - >; - - /** - * 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; - - /** - * Body param: An informative description of the ruleset. - */ - description?: string; -} - -export namespace RulesetCreateParams { - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } + */ + rules: Array< + | RulesAPI.BlockRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule + | RulesAPI.ExecuteRule + | RulesAPI.JsChallengeRule + | RulesAPI.LogRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule + | RulesAPI.SkipRule + | RulesAPI.SetCacheSettingsRule + >; - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export interface StatusCodeRange { - /** - * response status code lower bound - */ - from: number; + /** + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. + */ + account_id?: string; - /** - * response status code upper bound - */ - to: number; - } - } - } + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. + */ + zone_id?: string; - /** - * 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. - */ - export 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; - } - } - } + /** + * Body param: An informative description of the ruleset. + */ + description?: string; } export interface RulesetUpdateParams { @@ -5982,20 +599,20 @@ export interface RulesetUpdateParams { */ rules: Array< | RulesAPI.BlockRule - | RulesetUpdateParams.RulesetsChallengeRule - | RulesetUpdateParams.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesetUpdateParams.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | RulesetUpdateParams.RulesetsManagedChallengeRule - | RulesetUpdateParams.RulesetsRedirectRule - | RulesetUpdateParams.RulesetsRewriteRule - | RulesetUpdateParams.RulesetsRouteRule - | RulesetUpdateParams.RulesetsScoreRule - | RulesetUpdateParams.RulesetsServeErrorRule - | RulesetUpdateParams.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | RulesetUpdateParams.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -6054,1228 +671,6 @@ export interface RulesetUpdateParams { | 'magic_transit_managed'; } -export namespace RulesetUpdateParams { - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export 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; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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 RulesetListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -7320,10 +715,22 @@ export namespace Rulesets { export import PhaseGetParams = PhasesAPI.PhaseGetParams; export import Rules = RulesAPI.Rules; export import BlockRule = RulesAPI.BlockRule; + export import ChallengeRule = RulesAPI.ChallengeRule; + export import CompressResponseRule = RulesAPI.CompressResponseRule; export import ExecuteRule = RulesAPI.ExecuteRule; + export import JsChallengeRule = RulesAPI.JsChallengeRule; export import LogRule = RulesAPI.LogRule; export import Logging = RulesAPI.Logging; + export import ManagedChallengeRule = RulesAPI.ManagedChallengeRule; + export import RedirectRule = RulesAPI.RedirectRule; + export import RewriteRule = RulesAPI.RewriteRule; + export import RewriteURIPart = RulesAPI.RewriteURIPart; + export import RouteRule = RulesAPI.RouteRule; export import RulesetRule = RulesAPI.RulesetRule; + export import ScoreRule = RulesAPI.ScoreRule; + export import ServeErrorRule = RulesAPI.ServeErrorRule; + export import SetCacheSettingsRule = RulesAPI.SetCacheSettingsRule; + export import SetConfigRule = RulesAPI.SetConfigRule; export import SkipRule = RulesAPI.SkipRule; export import RuleCreateResponse = RulesAPI.RuleCreateResponse; export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; diff --git a/src/resources/rulesets/versions/by-tag.ts b/src/resources/rulesets/versions/by-tag.ts index edb502335c..c4e42ce478 100644 --- a/src/resources/rulesets/versions/by-tag.ts +++ b/src/resources/rulesets/versions/by-tag.ts @@ -83,20 +83,20 @@ export interface ByTagGetResponse { */ rules: Array< | RulesAPI.BlockRule - | ByTagGetResponse.RulesetsChallengeRule - | ByTagGetResponse.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | ByTagGetResponse.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | ByTagGetResponse.RulesetsManagedChallengeRule - | ByTagGetResponse.RulesetsRedirectRule - | ByTagGetResponse.RulesetsRewriteRule - | ByTagGetResponse.RulesetsRouteRule - | ByTagGetResponse.RulesetsScoreRule - | ByTagGetResponse.RulesetsServeErrorRule - | ByTagGetResponse.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | ByTagGetResponse.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -110,1393 +110,6 @@ export interface ByTagGetResponse { description?: string; } -export namespace ByTagGetResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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 ByTagGetParams { /** * The unique ID of the account. diff --git a/src/resources/rulesets/versions/versions.ts b/src/resources/rulesets/versions/versions.ts index 6b8e41e76a..8134342e1a 100644 --- a/src/resources/rulesets/versions/versions.ts +++ b/src/resources/rulesets/versions/versions.ts @@ -205,20 +205,20 @@ export interface VersionGetResponse { */ rules: Array< | RulesAPI.BlockRule - | VersionGetResponse.RulesetsChallengeRule - | VersionGetResponse.RulesetsCompressResponseRule + | RulesAPI.ChallengeRule + | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | VersionGetResponse.RulesetsJsChallengeRule + | RulesAPI.JsChallengeRule | RulesAPI.LogRule - | VersionGetResponse.RulesetsManagedChallengeRule - | VersionGetResponse.RulesetsRedirectRule - | VersionGetResponse.RulesetsRewriteRule - | VersionGetResponse.RulesetsRouteRule - | VersionGetResponse.RulesetsScoreRule - | VersionGetResponse.RulesetsServeErrorRule - | VersionGetResponse.RulesetsSetConfigRule + | RulesAPI.ManagedChallengeRule + | RulesAPI.RedirectRule + | RulesAPI.RewriteRule + | RulesAPI.RouteRule + | RulesAPI.ScoreRule + | RulesAPI.ServeErrorRule + | RulesAPI.SetConfigRule | RulesAPI.SkipRule - | VersionGetResponse.RulesetsSetCacheSettingsRule + | RulesAPI.SetCacheSettingsRule >; /** @@ -232,1393 +232,6 @@ export interface VersionGetResponse { description?: string; } -export namespace VersionGetResponse { - export interface RulesetsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsCompressResponseRule { - /** - * 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?: RulesetsCompressResponseRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsCompressResponseRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Custom order for compression algorithms. - */ - algorithms?: Array; - } - - export namespace ActionParameters { - /** - * Compression algorithm to enable. - */ - export interface Algorithm { - /** - * Name of compression algorithm to enable. - */ - name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; - } - } - } - - export interface RulesetsJsChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsManagedChallengeRule { - /** - * 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; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsRedirectRule { - /** - * 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?: RulesetsRedirectRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRedirectRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Serve a redirect based on a bulk list lookup. - */ - export 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. - */ - export 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; - } - - export namespace FromValue { - export interface StaticURLRedirect { - /** - * The URL to redirect the request to. - */ - value?: string; - } - - export interface DynamicURLRedirect { - /** - * An expression to evaluate to get the URL to redirect the request to. - */ - expression?: string; - } - } - } - } - - export interface RulesetsRewriteRule { - /** - * 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?: RulesetsRewriteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRewriteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Remove the header from the request. - */ - export interface RemoveHeader { - operation: 'remove'; - } - - /** - * Set a request header with a static value. - */ - export interface StaticHeader { - operation: 'set'; - - /** - * Static value for the header. - */ - value: string; - } - - /** - * Set a request header with a dynamic value. - */ - export interface DynamicHeader { - /** - * Expression for the header value. - */ - expression: string; - - operation: 'set'; - } - - /** - * URI to rewrite the request to. - */ - export interface URI { - /** - * Path portion rewrite. - */ - path?: URI.StaticValue | URI.DynamicValue; - - /** - * Query portion rewrite. - */ - query?: URI.StaticValue | URI.DynamicValue; - } - - export namespace URI { - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - - export interface StaticValue { - /** - * Predefined replacement value. - */ - value: string; - } - - export interface DynamicValue { - /** - * Expression to evaluate for the replacement value. - */ - expression: string; - } - } - } - } - - export interface RulesetsRouteRule { - /** - * 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?: RulesetsRouteRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsRouteRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Override the IP/TCP destination. - */ - export interface Origin { - /** - * Override the resolved hostname. - */ - host?: string; - - /** - * Override the destination port. - */ - port?: number; - } - - /** - * Override the Server Name Indication (SNI). - */ - export interface Sni { - /** - * The SNI override. - */ - value: string; - } - } - } - - export interface RulesetsScoreRule { - /** - * 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?: RulesetsScoreRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsScoreRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * Increment contains the delta to change the score and can be either positive or - * negative. - */ - increment?: number; - } - } - - export interface RulesetsServeErrorRule { - /** - * 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?: RulesetsServeErrorRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export 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 RulesetsSetConfigRule { - /** - * 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?: RulesetsSetConfigRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetConfigRule { - /** - * The parameters configuring the rule's action. - */ - export 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; - } - - export namespace ActionParameters { - /** - * Select which file extensions to minify automatically. - */ - export interface Autominify { - /** - * Minify CSS files. - */ - css?: boolean; - - /** - * Minify HTML files. - */ - html?: boolean; - - /** - * Minify JS files. - */ - js?: boolean; - } - } - } - - export interface RulesetsSetCacheSettingsRule { - /** - * 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?: RulesetsSetCacheSettingsRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * 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?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsSetCacheSettingsRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * List of additional ports that caching can be enabled on. - */ - additional_cacheable_ports?: Array; - - /** - * 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; - } - - export 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. - */ - export 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. - */ - export 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; - } - - export namespace CacheKey { - /** - * Customize which components of the request are included or excluded from the - * cache key. - */ - export 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; - } - - export namespace CustomKey { - /** - * The cookies to include in building the cache key. - */ - export 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; - - /** - * Include these cookies' names and their values. - */ - include?: Array; - } - - /** - * The header names and values to include in building the cache key. - */ - export 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; - - /** - * 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; - } - - /** - * Whether to use the original host or the resolved host in the cache key. - */ - export 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. - */ - export 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; - } - - export namespace QueryString { - /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters - */ - export 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; - } - - /** - * build the cache key using a list of query string parameters that ARE in the - * request. - */ - export 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; - } - } - - /** - * Characteristics of the request user agent used in building the cache key. - */ - export 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). - */ - export 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. - */ - export 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; - } - - export 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 - */ - export 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; - } - - export namespace StatusCodeTTL { - /** - * The range of status codes used to apply the selected mode. - */ - export 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. - */ - export 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 VersionListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. diff --git a/src/resources/warp-connector.ts b/src/resources/warp-connector.ts index 8b6e833442..48cb5cf1d3 100644 --- a/src/resources/warp-connector.ts +++ b/src/resources/warp-connector.ts @@ -132,7 +132,7 @@ export namespace WARPConnectorCreateResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -180,6 +180,53 @@ export namespace WARPConnectorCreateResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } /** @@ -207,7 +254,7 @@ export namespace WARPConnectorListResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -255,6 +302,53 @@ export namespace WARPConnectorListResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } /** @@ -282,7 +376,7 @@ export namespace WARPConnectorDeleteResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -330,6 +424,53 @@ export namespace WARPConnectorDeleteResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } /** @@ -357,7 +498,7 @@ export namespace WARPConnectorEditResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -405,6 +546,53 @@ export namespace WARPConnectorEditResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } /** @@ -430,7 +618,7 @@ export namespace WARPConnectorGetResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -478,6 +666,53 @@ export namespace WARPConnectorGetResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } export type WARPConnectorTokenResponse = unknown | Array | string; diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts index 94e7ace6e7..0ac53688ed 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts @@ -3,6 +3,14 @@ export { BindingGetResponse, BindingGetParams, Bindings } from './bindings'; export { ContentUpdateParams, ContentGetParams, Content } from './content'; export { Script, ScriptUpdateParams, ScriptDeleteParams, ScriptGetParams, Scripts } from './scripts'; +export { + SecretUpdateResponse, + SecretListResponse, + SecretUpdateParams, + SecretListParams, + SecretListResponsesSinglePage, + Secrets, +} from './secrets'; export { SettingEditResponse, SettingGetResponse, @@ -10,3 +18,13 @@ export { SettingGetParams, Settings, } from './settings'; +export { + TagUpdateResponse, + TagListResponse, + TagDeleteResponse, + TagUpdateParams, + TagListParams, + TagDeleteParams, + TagListResponsesSinglePage, + Tags, +} from './tags'; diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts index b6f2909928..5db683bc5f 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts @@ -8,13 +8,17 @@ import * as ScriptsAPI from 'cloudflare/resources/workers/scripts/scripts'; import * as TailAPI from 'cloudflare/resources/workers/scripts/tail'; import * as BindingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings'; import * as ContentAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/content'; +import * as SecretsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets'; import * as SettingsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/settings'; +import * as TagsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/tags'; import { type Uploadable, maybeMultipartFormRequestOptions } from 'cloudflare/core'; export class Scripts extends APIResource { content: ContentAPI.Content = new ContentAPI.Content(this._client); settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); bindings: BindingsAPI.Bindings = new BindingsAPI.Bindings(this._client); + secrets: SecretsAPI.Secrets = new SecretsAPI.Secrets(this._client); + tags: TagsAPI.Tags = new TagsAPI.Tags(this._client); /** * Upload a worker module to a Workers for Platforms namespace. You can find an @@ -250,4 +254,18 @@ export namespace Scripts { export import Bindings = BindingsAPI.Bindings; export import BindingGetResponse = BindingsAPI.BindingGetResponse; export import BindingGetParams = BindingsAPI.BindingGetParams; + export import Secrets = SecretsAPI.Secrets; + export import SecretUpdateResponse = SecretsAPI.SecretUpdateResponse; + export import SecretListResponse = SecretsAPI.SecretListResponse; + export import SecretListResponsesSinglePage = SecretsAPI.SecretListResponsesSinglePage; + export import SecretUpdateParams = SecretsAPI.SecretUpdateParams; + export import SecretListParams = SecretsAPI.SecretListParams; + export import Tags = TagsAPI.Tags; + export import TagUpdateResponse = TagsAPI.TagUpdateResponse; + export import TagListResponse = TagsAPI.TagListResponse; + export import TagDeleteResponse = TagsAPI.TagDeleteResponse; + export import TagListResponsesSinglePage = TagsAPI.TagListResponsesSinglePage; + export import TagUpdateParams = TagsAPI.TagUpdateParams; + export import TagListParams = TagsAPI.TagListParams; + export import TagDeleteParams = TagsAPI.TagDeleteParams; } diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts new file mode 100644 index 0000000000..293c8ef4b1 --- /dev/null +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts @@ -0,0 +1,107 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from 'cloudflare/core'; +import { APIResource } from 'cloudflare/resource'; +import * as SecretsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets'; +import { SinglePage } from 'cloudflare/pagination'; + +export class Secrets extends APIResource { + /** + * Put secrets to a script uploaded to a Workers for Platforms namespace. + */ + update( + dispatchNamespace: string, + scriptName: string, + params: SecretUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/secrets`, + { body, ...options }, + ) as Core.APIPromise<{ result: SecretUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetch secrets from a script uploaded to a Workers for Platforms namespace. + */ + list( + dispatchNamespace: string, + scriptName: string, + params: SecretListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/secrets`, + SecretListResponsesSinglePage, + options, + ); + } +} + +export class SecretListResponsesSinglePage extends SinglePage {} + +export interface SecretUpdateResponse { + /** + * The name of this secret, this is what will be to access it inside the Worker. + */ + name?: string; + + /** + * The type of secret to put. + */ + type?: 'secret_text'; +} + +export interface SecretListResponse { + /** + * The name of this secret, this is what will be to access it inside the Worker. + */ + name?: string; + + /** + * The type of secret to put. + */ + type?: 'secret_text'; +} + +export interface SecretUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: The name of this secret, this is what will be to access it inside + * the Worker. + */ + name?: string; + + /** + * Body param: The value of the secret. + */ + text?: string; + + /** + * Body param: The type of secret to put. + */ + type?: 'secret_text'; +} + +export interface SecretListParams { + /** + * Identifier + */ + account_id: string; +} + +export namespace Secrets { + export import SecretUpdateResponse = SecretsAPI.SecretUpdateResponse; + export import SecretListResponse = SecretsAPI.SecretListResponse; + export import SecretListResponsesSinglePage = SecretsAPI.SecretListResponsesSinglePage; + export import SecretUpdateParams = SecretsAPI.SecretUpdateParams; + export import SecretListParams = SecretsAPI.SecretListParams; +} diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts new file mode 100644 index 0000000000..00f706c5a0 --- /dev/null +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from 'cloudflare/core'; +import { APIResource } from 'cloudflare/resource'; +import * as TagsAPI from 'cloudflare/resources/workers-for-platforms/dispatch/namespaces/scripts/tags'; +import { SinglePage } from 'cloudflare/pagination'; + +export class Tags extends APIResource { + /** + * Put script tags for a script uploaded to a Workers for Platforms namespace. + */ + update( + dispatchNamespace: string, + scriptName: string, + params: TagUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body } = params; + return ( + this._client.put( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/tags`, + { body: body, ...options }, + ) as Core.APIPromise<{ result: TagUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetch tags from a script uploaded to a Workers for Platforms namespace. + */ + list( + dispatchNamespace: string, + scriptName: string, + params: TagListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/tags`, + TagListResponsesSinglePage, + options, + ); + } + + /** + * Delete script tag for a script uploaded to a Workers for Platforms namespace. + */ + delete( + dispatchNamespace: string, + scriptName: string, + tag: string, + params: TagDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/tags/${tag}`, + options, + ) as Core.APIPromise<{ result: TagDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TagListResponsesSinglePage extends SinglePage {} + +export type TagUpdateResponse = Array; + +/** + * Tag to help you manage your Worker + */ +export type TagListResponse = string; + +export type TagDeleteResponse = unknown; + +export interface TagUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Tags to help you manage your Workers + */ + body: Array; +} + +export interface TagListParams { + /** + * Identifier + */ + account_id: string; +} + +export interface TagDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export namespace Tags { + export import TagUpdateResponse = TagsAPI.TagUpdateResponse; + export import TagListResponse = TagsAPI.TagListResponse; + export import TagDeleteResponse = TagsAPI.TagDeleteResponse; + export import TagListResponsesSinglePage = TagsAPI.TagListResponsesSinglePage; + export import TagUpdateParams = TagsAPI.TagUpdateParams; + export import TagListParams = TagsAPI.TagListParams; + export import TagDeleteParams = TagsAPI.TagDeleteParams; +} diff --git a/src/resources/zero-trust/tunnels/connections.ts b/src/resources/zero-trust/tunnels/connections.ts index 43951848cf..a79bd57490 100644 --- a/src/resources/zero-trust/tunnels/connections.ts +++ b/src/resources/zero-trust/tunnels/connections.ts @@ -3,7 +3,6 @@ import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import * as ConnectionsAPI from 'cloudflare/resources/zero-trust/tunnels/connections'; -import * as TunnelsAPI from 'cloudflare/resources/zero-trust/tunnels/tunnels'; export class Connections extends APIResource { /** @@ -66,7 +65,7 @@ export interface Client { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - conns?: TunnelsAPI.Connection; + conns?: Array; /** * Features enabled for the Cloudflare Tunnel. @@ -84,6 +83,53 @@ export interface Client { version?: string; } +export namespace Client { + export interface Conn { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } +} + export type ConnectionDeleteResponse = unknown | Array | string; export type ConnectionGetResponse = Array; diff --git a/src/resources/zero-trust/tunnels/tunnels.ts b/src/resources/zero-trust/tunnels/tunnels.ts index 064befab5b..499da65925 100644 --- a/src/resources/zero-trust/tunnels/tunnels.ts +++ b/src/resources/zero-trust/tunnels/tunnels.ts @@ -97,56 +97,24 @@ export class Tunnels extends APIResource { export class TunnelListResponsesV4PagePaginationArray extends V4PagePaginationArray {} -/** - * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. - */ -export type Connection = Array; - -export namespace Connection { - export interface ConnectionItem { - /** - * UUID of the Cloudflare Tunnel connection. - */ - id?: string; - - /** - * UUID of the cloudflared instance. - */ - client_id?: unknown; - - /** - * The cloudflared version used to establish this connection. - */ - client_version?: string; - - /** - * The Cloudflare data center used for this connection. - */ - colo_name?: string; - - /** - * Cloudflare continues to track connections for several minutes after they - * disconnect. This is an optimization to improve latency and reliability of - * reconnecting. If `true`, the connection has disconnected but is still being - * tracked. If `false`, the connection is actively serving traffic. - */ - is_pending_reconnect?: boolean; - - /** - * Timestamp of when the connection was established. - */ - opened_at?: string; +export interface Connection { + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; - /** - * The public IP address of the host running cloudflared. - */ - origin_ip?: string; + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; - /** - * UUID of the Cloudflare Tunnel connection. - */ - uuid?: string; - } + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; } /** @@ -166,7 +134,7 @@ export interface Tunnel { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -221,6 +189,53 @@ export interface Tunnel { tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } +export namespace Tunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } +} + export interface TunnelCreateResponse { /** * UUID of the tunnel. @@ -230,7 +245,7 @@ export interface TunnelCreateResponse { /** * The tunnel connections between your origin and Cloudflare's edge. */ - connections: Array; + connections: Array; /** * Timestamp of when the tunnel was created. @@ -249,28 +264,6 @@ export interface TunnelCreateResponse { deleted_at?: string | null; } -export namespace TunnelCreateResponse { - export interface Connection { - /** - * The Cloudflare data center used for this connection. - */ - colo_name?: string; - - /** - * Cloudflare continues to track connections for several minutes after they - * disconnect. This is an optimization to improve latency and reliability of - * reconnecting. If `true`, the connection has disconnected but is still being - * tracked. If `false`, the connection is actively serving traffic. - */ - is_pending_reconnect?: boolean; - - /** - * UUID of the Cloudflare Tunnel connection. - */ - uuid?: string; - } -} - /** * A Cloudflare Tunnel that connects your origin to Cloudflare's edge. */ @@ -294,7 +287,7 @@ export namespace TunnelListResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -342,6 +335,53 @@ export namespace TunnelListResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } export interface TunnelDeleteResponse { @@ -353,7 +393,7 @@ export interface TunnelDeleteResponse { /** * The tunnel connections between your origin and Cloudflare's edge. */ - connections: Array; + connections: Array; /** * Timestamp of when the tunnel was created. @@ -372,28 +412,6 @@ export interface TunnelDeleteResponse { deleted_at?: string | null; } -export namespace TunnelDeleteResponse { - export interface Connection { - /** - * The Cloudflare data center used for this connection. - */ - colo_name?: string; - - /** - * Cloudflare continues to track connections for several minutes after they - * disconnect. This is an optimization to improve latency and reliability of - * reconnecting. If `true`, the connection has disconnected but is still being - * tracked. If `false`, the connection is actively serving traffic. - */ - is_pending_reconnect?: boolean; - - /** - * UUID of the Cloudflare Tunnel connection. - */ - uuid?: string; - } -} - /** * A Cloudflare Tunnel that connects your origin to Cloudflare's edge. */ @@ -417,7 +435,7 @@ export namespace TunnelEditResponse { /** * The Cloudflare Tunnel connections between your origin and Cloudflare's edge. */ - connections?: TunnelsAPI.Connection; + connections?: Array; /** * Timestamp of when the tunnel established at least one connection to Cloudflare's @@ -465,6 +483,53 @@ export namespace TunnelEditResponse { */ tun_type?: 'cfd_tunnel' | 'warp_connector' | 'ip_sec' | 'gre' | 'cni'; } + + export namespace TunnelWARPConnectorTunnel { + export interface Connection { + /** + * UUID of the Cloudflare Tunnel connection. + */ + id?: string; + + /** + * UUID of the cloudflared instance. + */ + client_id?: unknown; + + /** + * The cloudflared version used to establish this connection. + */ + client_version?: string; + + /** + * The Cloudflare data center used for this connection. + */ + colo_name?: string; + + /** + * Cloudflare continues to track connections for several minutes after they + * disconnect. This is an optimization to improve latency and reliability of + * reconnecting. If `true`, the connection has disconnected but is still being + * tracked. If `false`, the connection is actively serving traffic. + */ + is_pending_reconnect?: boolean; + + /** + * Timestamp of when the connection was established. + */ + opened_at?: string; + + /** + * The public IP address of the host running cloudflared. + */ + origin_ip?: string; + + /** + * UUID of the Cloudflare Tunnel connection. + */ + uuid?: string; + } + } } export interface TunnelGetResponse { @@ -476,7 +541,7 @@ export interface TunnelGetResponse { /** * The tunnel connections between your origin and Cloudflare's edge. */ - connections: Array; + connections: Array; /** * Timestamp of when the tunnel was created. @@ -495,28 +560,6 @@ export interface TunnelGetResponse { deleted_at?: string | null; } -export namespace TunnelGetResponse { - export interface Connection { - /** - * The Cloudflare data center used for this connection. - */ - colo_name?: string; - - /** - * Cloudflare continues to track connections for several minutes after they - * disconnect. This is an optimization to improve latency and reliability of - * reconnecting. If `true`, the connection has disconnected but is still being - * tracked. If `false`, the connection is actively serving traffic. - */ - is_pending_reconnect?: boolean; - - /** - * UUID of the Cloudflare Tunnel connection. - */ - uuid?: string; - } -} - export interface TunnelCreateParams { /** * Path param: Cloudflare account ID diff --git a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts new file mode 100644 index 0000000000..3802a45093 --- /dev/null +++ b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts @@ -0,0 +1,67 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource secrets', () => { + // skipped: tests are disabled for the time being + test.skip('update: only required params', async () => { + const responsePromise = cloudflare.workersForPlatforms.dispatch.namespaces.scripts.secrets.update( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('update: required and optional params', async () => { + const response = await cloudflare.workersForPlatforms.dispatch.namespaces.scripts.secrets.update( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + name: 'MY_SECRET', + text: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + type: 'secret_text', + }, + ); + }); + + // skipped: tests are disabled for the time being + test.skip('list: only required params', async () => { + const responsePromise = cloudflare.workersForPlatforms.dispatch.namespaces.scripts.secrets.list( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('list: required and optional params', async () => { + const response = await cloudflare.workersForPlatforms.dispatch.namespaces.scripts.secrets.list( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/tags.test.ts b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/tags.test.ts new file mode 100644 index 0000000000..5631239597 --- /dev/null +++ b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/tags.test.ts @@ -0,0 +1,89 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource tags', () => { + // skipped: tests are disabled for the time being + test.skip('update: only required params', async () => { + const responsePromise = cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: ['my-tag', 'my-tag', 'my-tag'] }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('update: required and optional params', async () => { + const response = await cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353', body: ['my-tag', 'my-tag', 'my-tag'] }, + ); + }); + + // skipped: tests are disabled for the time being + test.skip('list: only required params', async () => { + const responsePromise = cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.list( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('list: required and optional params', async () => { + const response = await cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.list( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + // skipped: tests are disabled for the time being + test.skip('delete: only required params', async () => { + const responsePromise = cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.delete( + 'my-dispatch-namespace', + 'this-is_my_script-01', + 'my-tag', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('delete: required and optional params', async () => { + const response = await cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.delete( + 'my-dispatch-namespace', + 'this-is_my_script-01', + 'my-tag', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +});