cloudflare
Version:
The official TypeScript library for the Cloudflare API
90 lines • 3.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuditLogs = exports.BaseAuditLogs = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const error_1 = require("../../../core/error.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseAuditLogs = /* @__PURE__ */ (() => {
class BaseAuditLogs extends resource_1.APIResource {
/**
* Lists audit log entries for all Security Center insights in the account or zone,
* showing changes to insight status and classification.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const auditLogListResponse of client.securityCenter.insights.auditLogs.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params = {}, options) {
const { account_id, zone_id, ...query } = params ?? {};
if (!account_id && !zone_id) {
throw new error_1.CloudflareError('You must provide either account_id or zone_id.');
}
if (account_id && zone_id) {
throw new error_1.CloudflareError('You cannot provide both account_id and zone_id.');
}
const { accountOrZone, accountOrZoneId } = account_id ?
{
accountOrZone: 'accounts',
accountOrZoneId: account_id,
}
: {
accountOrZone: 'zones',
accountOrZoneId: zone_id,
};
return this._client.getAPIList((0, path_1.path) `/${accountOrZone}/${accountOrZoneId}/security-center/insights/audit-log`, (pagination_1.CursorPagination), { query, ...options });
}
/**
* Lists audit log entries for a specific Security Center insight, showing changes
* to its status and classification over time.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const auditLogListByInsightResponse of client.securityCenter.insights.auditLogs.listByInsight(
* 'issue_id',
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
listByInsight(issueID, params = {}, options) {
const { account_id, zone_id, ...query } = params ?? {};
if (!account_id && !zone_id) {
throw new error_1.CloudflareError('You must provide either account_id or zone_id.');
}
if (account_id && zone_id) {
throw new error_1.CloudflareError('You cannot provide both account_id and zone_id.');
}
const { accountOrZone, accountOrZoneId } = account_id ?
{
accountOrZone: 'accounts',
accountOrZoneId: account_id,
}
: {
accountOrZone: 'zones',
accountOrZoneId: zone_id,
};
return this._client.getAPIList((0, path_1.path) `/${accountOrZone}/${accountOrZoneId}/security-center/insights/${issueID}/audit-log`, (pagination_1.CursorPagination), { query, ...options });
}
}
BaseAuditLogs._key = Object.freeze([
'securityCenter',
'insights',
'auditLogs',
]);
return BaseAuditLogs;
})();
exports.BaseAuditLogs = BaseAuditLogs;
class AuditLogs extends BaseAuditLogs {
}
exports.AuditLogs = AuditLogs;
//# sourceMappingURL=audit-logs.js.map