cloudflare
Version:
The official TypeScript library for the Cloudflare API
99 lines • 3.92 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Audit = exports.BaseAudit = 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 BaseAudit = /* @__PURE__ */ (() => {
class BaseAudit extends resource_1.APIResource {
/**
* Gets a list of audit logs for an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const auditListResponse of client.accounts.logs.audit.list(
* {
* account_id: 'a67e14daa5f8dceeb91fe5449ba496ef',
* before: '2024-10-31',
* since: '2024-10-30',
* },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/logs/audit`, (pagination_1.CursorPaginationAfter), { query, ...options });
}
/**
* Returns the chronological change history for the resource identified by the
* given audit log entry.
*
* The endpoint first locates the source audit log entry by `id` (using
* `action_time` to narrow the lookup window), derives identifying filters from
* that entry, and then returns matching audit logs within the `since`/`before`
* window.
*
* The `result_info.history_status` field indicates the quality of the resource
* identification used:
*
* - `exact`: Resource was identified by the resource URI.
* - `approximate`: Resource was identified without the resource URI.
* - `unavailable`: The source audit log entry did not contain enough information
* to identify the resource; an empty result is returned.
*
* @example
* ```ts
* const response = await client.accounts.logs.audit.history(
* 'f174be97-19b1-40d6-954d-70cd5fbd52db',
* {
* account_id: 'a67e14daa5f8dceeb91fe5449ba496ef',
* action_time: '2024-10-30T15:00:00Z',
* before: '2024-10-31',
* since: '2024-10-30',
* },
* );
* ```
*/
history(id, params, options) {
const { account_id, ...query } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/logs/audit/${id}/history`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists the available audit log product categories and the resource products each
* one expands to. Use these values with the product_category filter on the account
* audit logs endpoint.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const auditProductCategoriesResponse of client.accounts.logs.audit.productCategories(
* { account_id: 'a67e14daa5f8dceeb91fe5449ba496ef' },
* )) {
* // ...
* }
* ```
*/
productCategories(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/logs/audit/product_categories`, (pagination_1.SinglePage), options);
}
}
BaseAudit._key = Object.freeze([
'accounts',
'logs',
'audit',
]);
return BaseAudit;
})();
exports.BaseAudit = BaseAudit;
class Audit extends BaseAudit {
}
exports.Audit = Audit;
//# sourceMappingURL=audit.js.map