UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

151 lines • 8.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Rules = exports.BaseRules = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseRules = /* @__PURE__ */ (() => { /** * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ class BaseRules extends resource_1.APIResource { /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Create one or more firewall rules. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ create(params, options) { const { zone_id, ...body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules`, (pagination_1.SinglePage), { body, method: 'post', ...options, }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Updates an existing firewall rule. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ update(ruleID, params, options) { const { zone_id, ...body } = params; return this._client.put((0, path_1.path) `/zones/${zone_id}/firewall/rules/${ruleID}`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Fetches firewall rules in a zone. You can filter the results using several * optional parameters. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Deletes an existing firewall rule. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ delete(ruleID, params, options) { const { zone_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/firewall/rules/${ruleID}`, options)._thenUnwrap((obj) => obj.result); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Deletes existing firewall rules. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ bulkDelete(params, options) { const { zone_id } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules`, (pagination_1.SinglePage), { method: 'delete', ...options, }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Updates the priority of existing firewall rules. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ bulkEdit(params, options) { const { zone_id, ...body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules`, (pagination_1.SinglePage), { body, method: 'patch', ...options, }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Updates one or more existing firewall rules. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ bulkUpdate(params, options) { const { zone_id, ...body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules`, (pagination_1.SinglePage), { body, method: 'put', ...options, }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Updates the priority of an existing firewall rule. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ edit(ruleID, params, options) { const { zone_id, ...body } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/rules/${ruleID}`, (pagination_1.SinglePage), { body, method: 'patch', ...options }); } /** * **This endpoint has been deprecated and returns 410 Gone. Please use the * [Rulesets API](https://developers.cloudflare.com/ruleset-engine/) instead.** * * Fetches the details of a firewall rule. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ get(ruleID, params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/firewall/rules/${ruleID}`, options)._thenUnwrap((obj) => obj.result); } } BaseRules._key = Object.freeze([ 'firewall', 'rules', ]); return BaseRules; })(); exports.BaseRules = BaseRules; /** * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ class Rules extends BaseRules { } exports.Rules = Rules; //# sourceMappingURL=rules.js.map