UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

183 lines • 6.07 kB
import { APIResource } from "../../../../core/resource.js"; import * as ItemsAPI from "./items.js"; import { BaseItems, ItemDeleteParams, ItemDeleteResponse, ItemEditParams, ItemEditResponse, ItemGetParams, ItemGetResponse, Items } from "./items.js"; import { APIPromise } from "../../../../core/api-promise.js"; import { PagePromise, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../../../core/pagination.js"; import { RequestOptions } from "../../../../internal/request-options.js"; export declare class BaseAllowlist extends APIResource { static readonly _key: readonly ['DDoSProtection', 'advancedTCPProtection', 'allowlist']; /** * Create an allowlist prefix for an account. * * @example * ```ts * const allowlist = * await client.DDoSProtection.advancedTCPProtection.allowlist.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * comment: 'comment', * enabled: true, * prefix: 'prefix', * }, * ); * ``` */ create(params: AllowlistCreateParams, options?: RequestOptions): APIPromise<AllowlistCreateResponse>; /** * List all allowlist prefixes for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const allowlistListResponse of client.DDoSProtection.advancedTCPProtection.allowlist.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params: AllowlistListParams, options?: RequestOptions): PagePromise<AllowlistListResponsesV4PagePaginationArray, AllowlistListResponse>; /** * Delete all allowlist prefixes for an account. * * @example * ```ts * const response = * await client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ bulkDelete(params: AllowlistBulkDeleteParams, options?: RequestOptions): APIPromise<AllowlistBulkDeleteResponse>; } export declare class Allowlist extends BaseAllowlist { items: ItemsAPI.Items; } export type AllowlistListResponsesV4PagePaginationArray = V4PagePaginationArray<AllowlistListResponse>; export interface AllowlistCreateResponse { /** * The unique ID of the allowlist prefix. */ id: string; /** * An optional comment describing the allowlist prefix. */ comment: string; /** * The creation timestamp of the allowlist prefix. */ created_on: string; /** * Whether to enable the allowlist prefix into effect. Defaults to false. */ enabled: boolean; /** * The last modification timestamp of the allowlist prefix. */ modified_on: string; /** * The allowlist prefix in CIDR format. */ prefix: string; } export interface AllowlistListResponse { /** * The unique ID of the allowlist prefix. */ id: string; /** * An optional comment describing the allowlist prefix. */ comment: string; /** * The creation timestamp of the allowlist prefix. */ created_on: string; /** * Whether to enable the allowlist prefix into effect. Defaults to false. */ enabled: boolean; /** * The last modification timestamp of the allowlist prefix. */ modified_on: string; /** * The allowlist prefix in CIDR format. */ prefix: string; } export interface AllowlistBulkDeleteResponse { errors: Array<AllowlistBulkDeleteResponse.Error>; messages: Array<AllowlistBulkDeleteResponse.Message>; /** * Whether the API call was successful. */ success: true; } export declare namespace AllowlistBulkDeleteResponse { interface Error { code: number; message: string; documentation_url?: string; source?: Error.Source; } namespace Error { interface Source { pointer?: string; } } interface Message { code: number; message: string; documentation_url?: string; source?: Message.Source; } namespace Message { interface Source { pointer?: string; } } } export interface AllowlistCreateParams { /** * Path param: The ID of the account. */ account_id: string; /** * Body param: An comment describing the allowlist prefix. */ comment: string; /** * Body param: Whether to enable the allowlist prefix into effect. */ enabled: boolean; /** * Body param: The allowlist prefix to add in CIDR format. */ prefix: string; } export interface AllowlistListParams extends V4PagePaginationArrayParams { /** * Path param: The ID of the account. */ account_id: string; /** * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. */ direction?: string; /** * Query param: The field to order by. Defaults to 'prefix'. */ order?: string; } export interface AllowlistBulkDeleteParams { /** * The ID of the account. */ account_id: string; } export declare namespace Allowlist { export { type AllowlistCreateResponse as AllowlistCreateResponse, type AllowlistListResponse as AllowlistListResponse, type AllowlistBulkDeleteResponse as AllowlistBulkDeleteResponse, type AllowlistListResponsesV4PagePaginationArray as AllowlistListResponsesV4PagePaginationArray, type AllowlistCreateParams as AllowlistCreateParams, type AllowlistListParams as AllowlistListParams, type AllowlistBulkDeleteParams as AllowlistBulkDeleteParams, }; export { Items as Items, BaseItems as BaseItems, type ItemDeleteResponse as ItemDeleteResponse, type ItemEditResponse as ItemEditResponse, type ItemGetResponse as ItemGetResponse, type ItemDeleteParams as ItemDeleteParams, type ItemEditParams as ItemEditParams, type ItemGetParams as ItemGetParams, }; } //# sourceMappingURL=allowlist.d.ts.map