cloudflare
Version:
The official TypeScript library for the Cloudflare API
52 lines • 2.04 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as LockdownsAPI from 'cloudflare/resources/firewall/lockdowns';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class Lockdowns extends APIResource {
/**
* Creates a new Zone Lockdown rule.
*/
create(zoneIdentifier, body, options) {
return this._client.post(`/zones/${zoneIdentifier}/firewall/lockdowns`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates an existing Zone Lockdown rule.
*/
update(zoneIdentifier, id, body, options) {
return this._client.put(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
list(zoneIdentifier, query = {}, options) {
if (isRequestOptions(query)) {
return this.list(zoneIdentifier, {}, query);
}
return this._client.getAPIList(`/zones/${zoneIdentifier}/firewall/lockdowns`, LockdownsV4PagePaginationArray, { query, ...options });
}
/**
* Deletes an existing Zone Lockdown rule.
*/
delete(zoneIdentifier, id, body, options) {
return this._client.delete(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches the details of a Zone Lockdown rule.
*/
get(zoneIdentifier, id, options) {
return this._client.get(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class LockdownsV4PagePaginationArray extends V4PagePaginationArray {
}
(function (Lockdowns) {
Lockdowns.LockdownsV4PagePaginationArray = LockdownsAPI.LockdownsV4PagePaginationArray;
})(Lockdowns || (Lockdowns = {}));
//# sourceMappingURL=lockdowns.mjs.map