UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

84 lines • 3.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Rules = exports.BaseRules = 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 BaseRules = /* @__PURE__ */ (() => { class BaseRules extends resource_1.APIResource { /** * Create a SYN Protection rule for an account. * * @example * ```ts * const rule = * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * burst_sensitivity: 'burst_sensitivity', * mode: 'mode', * name: 'name', * rate_sensitivity: 'rate_sensitivity', * scope: 'scope', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * List all SYN Protection rules for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const ruleListResponse of client.DDoSProtection.advancedTCPProtection.synProtection.rules.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/syn_protection/rules`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Delete all SYN Protection rules for an account. * * @example * ```ts * const response = * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.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/syn_protection/rules`, options); } } BaseRules._key = Object.freeze(['DDoSProtection', 'advancedTCPProtection', 'synProtection', 'rules']); return BaseRules; })(); exports.BaseRules = BaseRules; var Rules = /* @__PURE__ */ (() => { class Rules extends BaseRules { constructor() { super(...arguments); this.items = new ItemsAPI.Items(this._client); } } Rules.Items = items_1.Items; Rules.BaseItems = items_1.BaseItems; return Rules; })(); exports.Rules = Rules; //# sourceMappingURL=rules.js.map