cloudflare
Version:
The official TypeScript library for the Cloudflare API
168 lines • 6.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Findings = exports.BaseFindings = void 0;
const tslib_1 = require("../../../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../../core/resource.js");
const InstancesAPI = tslib_1.__importStar(require("./instances.js"));
const instances_1 = require("./instances.js");
const pagination_1 = require("../../../../../core/pagination.js");
const path_1 = require("../../../../../internal/utils/path.js");
var BaseFindings = /* @__PURE__ */ (() => {
class BaseFindings extends resource_1.APIResource {
/**
* List all security findings that have been identified as being problematic. This
* will return a list of findings regardless if they have been ignored or not.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const findingListResponse of client.zeroTrust.casb.posture.findings.list(
* { account_id: '46148281d8a93d002ef242d8b0d5f9f6' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Creates a CSV export for findings and accepts optional filters in the payload.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.export({
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* });
* ```
*/
export(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/export`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Gets a security Finding that has been identified as being problematic.
*
* @example
* ```ts
* const finding =
* await client.zeroTrust.casb.posture.findings.get(
* 'U3RhaW5sZXNzIHJvY2tz',
* { account_id: '46148281d8a93d002ef242d8b0d5f9f6' },
* );
* ```
*/
get(findingID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/${findingID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Given a list of findings, mark as ignored. Does nothing if Finding is already
* ignored.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.ignore({
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* checks: [
* 'MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAxOjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMgo=',
* ],
* });
* ```
*/
ignore(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/ignore`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* If a Finding's severity has been changed, reset it back to default value. Does
* nothing if no override exists.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.resetSeverity(
* 'U3RhaW5sZXNzIHJvY2tz',
* { account_id: '46148281d8a93d002ef242d8b0d5f9f6' },
* );
* ```
*/
resetSeverity(findingID, params, options) {
const { account_id } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/${findingID}/reset_finding_severity`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Update the severity of a Finding. This will update the `severity_override` field
* on the Finding payload with the new severity value.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.tuneSeverity(
* 'U3RhaW5sZXNzIHJvY2tz',
* {
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* new_severity: 1,
* },
* );
* ```
*/
tuneSeverity(findingID, params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/${findingID}/tune_finding_severity`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Ability to un-ignore a Finding if it's previously been ignored. Does nothing if
* the Finding is not ignored.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.unignore({
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* checks: [
* 'MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAxOjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMgo=',
* ],
* });
* ```
*/
unignore(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/unignore`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseFindings._key = Object.freeze([
'zeroTrust',
'casb',
'posture',
'findings',
]);
return BaseFindings;
})();
exports.BaseFindings = BaseFindings;
var Findings = /* @__PURE__ */ (() => {
class Findings extends BaseFindings {
constructor() {
super(...arguments);
this.instances = new InstancesAPI.Instances(this._client);
}
}
Findings.Instances = instances_1.Instances;
Findings.BaseInstances = instances_1.BaseInstances;
return Findings;
})();
exports.Findings = Findings;
//# sourceMappingURL=findings.js.map