cloudflare
Version:
The official TypeScript library for the Cloudflare API
40 lines • 1.46 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Locks = void 0;
const resource_1 = require("../../../resource.js");
class Locks extends resource_1.APIResource {
/**
* Set lock rules for a bucket
*/
update(bucketName, params, options) {
const { account_id, jurisdiction, ...body } = params;
return this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/lock`, {
body,
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
/**
* Get lock rules for a bucket
*/
get(bucketName, params, options) {
const { account_id, jurisdiction } = params;
return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/lock`, {
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
}
exports.Locks = Locks;
//# sourceMappingURL=locks.js.map