UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

79 lines • 3 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 BaseAllowlist = /* @__PURE__ */ (() => { class BaseAllowlist extends APIResource { /** * 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, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * 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, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, (V4PagePaginationArray), { query, ...options }); } /** * Delete all allowlist prefixes for an account. * * @example * ```ts * const response = * await client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ bulkDelete(params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, options); } } BaseAllowlist._key = Object.freeze(['DDoSProtection', 'advancedTCPProtection', 'allowlist']); return BaseAllowlist; })(); export var Allowlist = /* @__PURE__ */ (() => { class Allowlist extends BaseAllowlist { constructor() { super(...arguments); this.items = new ItemsAPI.Items(this._client); } } Allowlist.Items = Items; Allowlist.BaseItems = BaseItems; return Allowlist; })(); //# sourceMappingURL=allowlist.mjs.map