cloudflare
Version:
The official TypeScript library for the Cloudflare API
107 lines • 3.97 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lockdowns = exports.BaseLockdowns = 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 BaseLockdowns = /* @__PURE__ */ (() => {
class BaseLockdowns extends resource_1.APIResource {
/**
* Creates a new Zone Lockdown rule.
*
* @example
* ```ts
* const lockdown = await client.firewall.lockdowns.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* configurations: [{}],
* urls: ['shop.example.com/*'],
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/firewall/lockdowns`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates an existing Zone Lockdown rule.
*
* @example
* ```ts
* const lockdown = await client.firewall.lockdowns.update(
* '372e67954025e0ba6aaa6d586b9e0b59',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* configurations: [{}],
* urls: ['shop.example.com/*'],
* },
* );
* ```
*/
update(lockDownsID, params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/firewall/lockdowns/${lockDownsID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches Zone Lockdown rules. You can filter the results using several optional
* parameters.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const lockdown of client.firewall.lockdowns.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/firewall/lockdowns`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes an existing Zone Lockdown rule.
*
* @example
* ```ts
* const lockdown = await client.firewall.lockdowns.delete(
* '372e67954025e0ba6aaa6d586b9e0b59',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(lockDownsID, params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/firewall/lockdowns/${lockDownsID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetches the details of a Zone Lockdown rule.
*
* @example
* ```ts
* const lockdown = await client.firewall.lockdowns.get(
* '372e67954025e0ba6aaa6d586b9e0b59',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(lockDownsID, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/firewall/lockdowns/${lockDownsID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseLockdowns._key = Object.freeze([
'firewall',
'lockdowns',
]);
return BaseLockdowns;
})();
exports.BaseLockdowns = BaseLockdowns;
class Lockdowns extends BaseLockdowns {
}
exports.Lockdowns = Lockdowns;
//# sourceMappingURL=lockdowns.js.map