cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 2.31 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventNotifications = void 0;
const resource_1 = require("../../../resource.js");
class EventNotifications extends resource_1.APIResource {
/**
* Create event notification rule.
*/
update(bucketName, queueId, params, options) {
const { account_id, jurisdiction, ...body } = params;
return this._client.put(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, {
body,
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
/**
* Delete an event notification rule. **If no body is provided, all rules for
* specified queue will be deleted**.
*/
delete(bucketName, queueId, params, options) {
const { account_id, jurisdiction } = params;
return this._client.delete(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, {
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
/**
* List all event notification rules for a bucket.
*/
get(bucketName, params, options) {
const { account_id, jurisdiction } = params;
return this._client.get(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration`, {
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
}
exports.EventNotifications = EventNotifications;
//# sourceMappingURL=event-notifications.js.map