UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

76 lines • 3.1 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../../core/resource.mjs"; import * as ItemsAPI from "./items.mjs"; import { BaseItems, Items, } from "./items.mjs"; import { V4PagePaginationArray, } from "../../../../../core/pagination.mjs"; import { path } from "../../../../../internal/utils/path.mjs"; export var BaseFilters = /* @__PURE__ */ (() => { class BaseFilters extends APIResource { /** * Create a SYN Protection filter for an account. * * @example * ```ts * const filter = * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * expression: * 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', * mode: 'mode', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * List all SYN Protection filters for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const filterListResponse of client.DDoSProtection.advancedTCPProtection.synProtection.filters.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, (V4PagePaginationArray), { query, ...options }); } /** * Delete all SYN Protection filters for an account. * * @example * ```ts * const response = * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.bulkDelete( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ bulkDelete(params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, options); } } BaseFilters._key = Object.freeze(['DDoSProtection', 'advancedTCPProtection', 'synProtection', 'filters']); return BaseFilters; })(); export var Filters = /* @__PURE__ */ (() => { class Filters extends BaseFilters { constructor() { super(...arguments); this.items = new ItemsAPI.Items(this._client); } } Filters.Items = Items; Filters.BaseItems = BaseItems; return Filters; })(); //# sourceMappingURL=filters.mjs.map