cloudflare
Version:
The official TypeScript library for the Cloudflare API
208 lines • 8.73 kB
TypeScript
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as PackagesAPI from 'cloudflare/resources/firewall/waf/packages/packages';
import * as GroupsAPI from 'cloudflare/resources/firewall/waf/packages/groups';
import * as RulesAPI from 'cloudflare/resources/firewall/waf/packages/rules';
import { V4PagePaginationArray, type V4PagePaginationArrayParams } from 'cloudflare/pagination';
export declare class Packages extends APIResource {
groups: GroupsAPI.Groups;
rules: RulesAPI.Rules;
/**
* Fetches WAF packages for a zone.
*
* **Note:** Applies only to the
* [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).
*/
list(zoneIdentifier: string, query?: PackageListParams, options?: Core.RequestOptions): Core.PagePromise<PackageListResponsesV4PagePaginationArray, PackageListResponse>;
list(zoneIdentifier: string, options?: Core.RequestOptions): Core.PagePromise<PackageListResponsesV4PagePaginationArray, PackageListResponse>;
/**
* Fetches the details of a WAF package.
*
* **Note:** Applies only to the
* [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).
*/
get(zoneIdentifier: string, identifier: string, options?: Core.RequestOptions): Core.APIPromise<PackageGetResponse>;
}
export declare class PackageListResponsesV4PagePaginationArray extends V4PagePaginationArray<PackageListResponse> {
}
export type PackageListResponse = PackageListResponse.LegacyJhsAPIResponseCollection | PackageListResponse.Result;
export declare namespace PackageListResponse {
interface LegacyJhsAPIResponseCollection {
errors: Array<LegacyJhsAPIResponseCollection.Error>;
messages: Array<LegacyJhsAPIResponseCollection.Message>;
result: unknown | Array<unknown> | string | null;
/**
* Whether the API call was successful
*/
success: true;
result_info?: LegacyJhsAPIResponseCollection.ResultInfo;
}
namespace LegacyJhsAPIResponseCollection {
interface Error {
code: number;
message: string;
}
interface Message {
code: number;
message: string;
}
interface ResultInfo {
/**
* Total number of results for the requested service
*/
count?: number;
/**
* Current page within paginated list of results
*/
page?: number;
/**
* Number of results per page of results
*/
per_page?: number;
/**
* Total results available without any search parameters
*/
total_count?: number;
}
}
interface Result {
result?: Array<Result.LegacyJhsPackageDefinition | Result.LegacyJhsAnomalyPackage>;
}
namespace Result {
interface LegacyJhsPackageDefinition {
/**
* The unique identifier of a WAF package.
*/
id: string;
/**
* A summary of the purpose/function of the WAF package.
*/
description: string;
/**
* The mode that defines how rules within the package are evaluated during the
* course of a request. When a package uses anomaly detection mode (`anomaly`
* value), each rule is given a score when triggered. If the total score of all
* triggered rules exceeds the sensitivity defined in the WAF package, the action
* configured in the package will be performed. Traditional detection mode
* (`traditional` value) will decide the action to take when it is triggered by the
* request. If multiple rules are triggered, the action providing the highest
* protection will be applied (for example, a 'block' action will win over a
* 'challenge' action).
*/
detection_mode: 'anomaly' | 'traditional';
/**
* The name of the WAF package.
*/
name: string;
/**
* Identifier
*/
zone_id: string;
/**
* When set to `active`, indicates that the WAF package will be applied to the
* zone.
*/
status?: 'active';
}
interface LegacyJhsAnomalyPackage {
/**
* The unique identifier of a WAF package.
*/
id: string;
/**
* A summary of the purpose/function of the WAF package.
*/
description: string;
/**
* When a WAF package uses anomaly detection, each rule is given a score when
* triggered. If the total score of all triggered rules exceeds the sensitivity
* defined on the WAF package, the action defined on the package will be taken.
*/
detection_mode: 'anomaly' | 'traditional';
/**
* The name of the WAF package.
*/
name: string;
/**
* Identifier
*/
zone_id: string;
/**
* The default action performed by the rules in the WAF package.
*/
action_mode?: 'simulate' | 'block' | 'challenge';
/**
* The sensitivity of the WAF package.
*/
sensitivity?: 'high' | 'medium' | 'low' | 'off';
/**
* When set to `active`, indicates that the WAF package will be applied to the
* zone.
*/
status?: 'active';
}
}
}
export type PackageGetResponse = PackageGetResponse.LegacyJhsAPIResponseSingle | PackageGetResponse.Result;
export declare namespace PackageGetResponse {
interface LegacyJhsAPIResponseSingle {
errors: Array<LegacyJhsAPIResponseSingle.Error>;
messages: Array<LegacyJhsAPIResponseSingle.Message>;
result: unknown | string | null;
/**
* Whether the API call was successful
*/
success: true;
}
namespace LegacyJhsAPIResponseSingle {
interface Error {
code: number;
message: string;
}
interface Message {
code: number;
message: string;
}
}
interface Result {
result?: unknown;
}
}
export interface PackageListParams extends V4PagePaginationArrayParams {
/**
* The direction used to sort returned packages.
*/
direction?: 'asc' | 'desc';
/**
* When set to `all`, all the search requirements must match. When set to `any`,
* only one of the search requirements has to match.
*/
match?: 'any' | 'all';
/**
* The field used to sort returned packages.
*/
order?: 'name';
}
export declare namespace Packages {
export import PackageListResponse = PackagesAPI.PackageListResponse;
export import PackageGetResponse = PackagesAPI.PackageGetResponse;
export import PackageListResponsesV4PagePaginationArray = PackagesAPI.PackageListResponsesV4PagePaginationArray;
export import PackageListParams = PackagesAPI.PackageListParams;
export import Groups = GroupsAPI.Groups;
export import WAFManagedRulesGroup = GroupsAPI.WAFManagedRulesGroup;
export import GroupEditResponse = GroupsAPI.GroupEditResponse;
export import GroupGetResponse = GroupsAPI.GroupGetResponse;
export import WAFManagedRulesGroupsV4PagePaginationArray = GroupsAPI.WAFManagedRulesGroupsV4PagePaginationArray;
export import GroupListParams = GroupsAPI.GroupListParams;
export import GroupEditParams = GroupsAPI.GroupEditParams;
export import GroupGetParams = GroupsAPI.GroupGetParams;
export import Rules = RulesAPI.Rules;
export import WAFManagedRulesRule = RulesAPI.WAFManagedRulesRule;
export import RuleEditResponse = RulesAPI.RuleEditResponse;
export import RuleGetResponse = RulesAPI.RuleGetResponse;
export import WAFManagedRulesRulesV4PagePaginationArray = RulesAPI.WAFManagedRulesRulesV4PagePaginationArray;
export import RuleListParams = RulesAPI.RuleListParams;
export import RuleEditParams = RulesAPI.RuleEditParams;
export import RuleGetParams = RulesAPI.RuleGetParams;
}
//# sourceMappingURL=packages.d.ts.map