cloudflare
Version:
The official TypeScript library for the Cloudflare API
78 lines • 3.1 kB
JavaScript
// 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 BaseRules = /* @__PURE__ */ (() => {
class BaseRules extends 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(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(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, (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(path `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, options);
}
}
BaseRules._key = Object.freeze(['DDoSProtection', 'advancedTCPProtection', 'synProtection', 'rules']);
return BaseRules;
})();
export var Rules = /* @__PURE__ */ (() => {
class Rules extends BaseRules {
constructor() {
super(...arguments);
this.items = new ItemsAPI.Items(this._client);
}
}
Rules.Items = Items;
Rules.BaseItems = BaseItems;
return Rules;
})();
//# sourceMappingURL=rules.mjs.map