cloudflare
Version:
The official TypeScript library for the Cloudflare API
57 lines • 2.58 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseRules = /* @__PURE__ */ (() => {
class BaseRules extends APIResource {
/**
* Fetches WAF rules in a WAF package.
*
* **Note:** Applies only to the
* [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).
*
* @deprecated
*/
list(packageID, params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList(path `/zones/${zone_id}/firewall/waf/packages/${packageID}/rules`, (V4PagePaginationArray), { query, ...options });
}
/**
* Updates a WAF rule. You can only update the mode/action of the rule.
*
* **Note:** Applies only to the
* [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).
*
* @deprecated
*/
edit(ruleID, params, options) {
const { zone_id, package_id, ...body } = params;
return this._client.patch(path `/zones/${zone_id}/firewall/waf/packages/${package_id}/rules/${ruleID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches the details of a WAF rule in a WAF package.
*
* **Note:** Applies only to the
* [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).
*
* @deprecated
*/
get(ruleID, params, options) {
const { zone_id, package_id } = params;
return this._client.get(path `/zones/${zone_id}/firewall/waf/packages/${package_id}/rules/${ruleID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseRules._key = Object.freeze([
'firewall',
'waf',
'packages',
'rules',
]);
return BaseRules;
})();
export class Rules extends BaseRules {
}
//# sourceMappingURL=rules.mjs.map