UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

82 lines • 3.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Filters = exports.BaseFilters = void 0; const tslib_1 = require("../../../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../../core/resource.js"); const ItemsAPI = tslib_1.__importStar(require("./items.js")); const items_1 = require("./items.js"); const pagination_1 = require("../../../../../core/pagination.js"); const path_1 = require("../../../../../internal/utils/path.js"); var BaseFilters = /* @__PURE__ */ (() => { class BaseFilters extends resource_1.APIResource { /** * Create a TCP Flow Protection filter for an account. * * @example * ```ts * const filter = * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.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((0, path_1.path) `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * List all TCP Flow Protection filters for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const filterListResponse of client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Delete all TCP Flow Protection filters for an account. * * @example * ```ts * const response = * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.bulkDelete( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ bulkDelete(params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, options); } } BaseFilters._key = Object.freeze(['DDoSProtection', 'advancedTCPProtection', 'tcpFlowProtection', 'filters']); return BaseFilters; })(); exports.BaseFilters = BaseFilters; var Filters = /* @__PURE__ */ (() => { class Filters extends BaseFilters { constructor() { super(...arguments); this.items = new ItemsAPI.Items(this._client); } } Filters.Items = items_1.Items; Filters.BaseItems = items_1.BaseItems; return Filters; })(); exports.Filters = Filters; //# sourceMappingURL=filters.js.map