cloudflare
Version:
The official TypeScript library for the Cloudflare API
136 lines • 5.3 kB
TypeScript
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as RulesAPI from 'cloudflare/resources/firewall/rules';
import * as FiltersAPI from 'cloudflare/resources/filters';
import * as RateLimitsAPI from 'cloudflare/resources/rate-limits';
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';
export declare class Rules extends APIResource {
/**
* Create one or more firewall rules.
*/
create(zoneIdentifier: string, body: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise<RuleCreateResponse | null>;
/**
* Updates an existing firewall rule.
*/
update(zoneIdentifier: string, id: string, body: RuleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<FirewallRule>;
/**
* Fetches firewall rules in a zone. You can filter the results using several
* optional parameters.
*/
list(zoneIdentifier: string, query?: RuleListParams, options?: Core.RequestOptions): Core.PagePromise<FirewallRulesV4PagePaginationArray, FirewallRule>;
list(zoneIdentifier: string, options?: Core.RequestOptions): Core.PagePromise<FirewallRulesV4PagePaginationArray, FirewallRule>;
/**
* Deletes an existing firewall rule.
*/
delete(zoneIdentifier: string, id: string, body: RuleDeleteParams, options?: Core.RequestOptions): Core.APIPromise<FirewallRule>;
/**
* Updates the priority of an existing firewall rule.
*/
edit(zoneIdentifier: string, id: string, body: RuleEditParams, options?: Core.RequestOptions): Core.APIPromise<RuleEditResponse | null>;
/**
* Fetches the details of a firewall rule.
*/
get(zoneIdentifier: string, params: RuleGetParams, options?: Core.RequestOptions): Core.APIPromise<FirewallRule>;
}
export declare class FirewallRulesV4PagePaginationArray extends V4PagePaginationArray<FirewallRule> {
}
export interface FirewallRule {
/**
* The unique identifier of the firewall rule.
*/
id?: string;
/**
* The action to apply to a matched request. The `log` action is only available on
* an Enterprise plan.
*/
action?: RateLimitsAPI.Action;
/**
* An informative summary of the firewall rule.
*/
description?: string;
filter?: FiltersAPI.FirewallFilter | DeletedFilter;
/**
* When true, indicates that the firewall rule is currently paused.
*/
paused?: boolean;
/**
* The priority of the rule. Optional value used to define the processing order. A
* lower number indicates a higher priority. If not provided, rules with a defined
* priority will be processed before rules without a priority.
*/
priority?: number;
products?: Array<Products>;
/**
* A short reference tag. Allows you to select related firewall rules.
*/
ref?: string;
}
/**
* A list of products to bypass for a request when using the `bypass` action.
*/
export type Products = 'zoneLockdown' | 'uaBlock' | 'bic' | 'hot' | 'securityLevel' | 'rateLimit' | 'waf';
export interface DeletedFilter {
/**
* The unique identifier of the filter.
*/
id: string;
/**
* When true, indicates that the firewall rule was deleted.
*/
deleted: boolean;
}
export type RuleCreateResponse = Array<FirewallRule>;
export type RuleEditResponse = Array<FirewallRule>;
export type RuleCreateParams = unknown;
export type RuleUpdateParams = unknown;
export interface RuleListParams extends V4PagePaginationArrayParams {
/**
* The unique identifier of the firewall rule.
*/
id?: string;
/**
* The action to search for. Must be an exact match.
*/
action?: string;
/**
* A case-insensitive string to find in the description.
*/
description?: string;
/**
* When true, indicates that the firewall rule is currently paused.
*/
paused?: boolean;
}
export interface RuleDeleteParams {
/**
* When true, indicates that Cloudflare should also delete the associated filter if
* there are no other firewall rules referencing the filter.
*/
delete_filter_if_unused?: boolean;
}
export type RuleEditParams = unknown;
export interface RuleGetParams {
/**
* Path param: The unique identifier of the firewall rule.
*/
path_id: string;
/**
* Query param: The unique identifier of the firewall rule.
*/
query_id?: string;
}
export declare namespace Rules {
export import FirewallRule = RulesAPI.FirewallRule;
export import Products = RulesAPI.Products;
export import DeletedFilter = RulesAPI.DeletedFilter;
export import RuleCreateResponse = RulesAPI.RuleCreateResponse;
export import RuleEditResponse = RulesAPI.RuleEditResponse;
export import FirewallRulesV4PagePaginationArray = RulesAPI.FirewallRulesV4PagePaginationArray;
export import RuleCreateParams = RulesAPI.RuleCreateParams;
export import RuleUpdateParams = RulesAPI.RuleUpdateParams;
export import RuleListParams = RulesAPI.RuleListParams;
export import RuleDeleteParams = RulesAPI.RuleDeleteParams;
export import RuleEditParams = RulesAPI.RuleEditParams;
export import RuleGetParams = RulesAPI.RuleGetParams;
}
//# sourceMappingURL=rules.d.ts.map