UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

94 lines • 3.71 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { CursorPaginationAfter, SinglePage, } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseAudit = /* @__PURE__ */ (() => { class BaseAudit extends 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(path `/accounts/${account_id}/logs/audit`, (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(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(path `/accounts/${account_id}/logs/audit/product_categories`, (SinglePage), options); } } BaseAudit._key = Object.freeze([ 'accounts', 'logs', 'audit', ]); return BaseAudit; })(); export class Audit extends BaseAudit { } //# sourceMappingURL=audit.mjs.map