cloudflare
Version:
The official TypeScript library for the Cloudflare API
162 lines • 6.37 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../../core/resource.mjs";
import * as InstancesAPI from "./instances.mjs";
import { BaseInstances, Instances, } from "./instances.mjs";
import { V4PagePaginationArray, } from "../../../../../core/pagination.mjs";
import { path } from "../../../../../internal/utils/path.mjs";
export var BaseFindings = /* @__PURE__ */ (() => {
class BaseFindings extends 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(path `/accounts/${account_id}/data-security/posture/findings`, (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(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(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(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(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(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(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;
})();
export var Findings = /* @__PURE__ */ (() => {
class Findings extends BaseFindings {
constructor() {
super(...arguments);
this.instances = new InstancesAPI.Instances(this._client);
}
}
Findings.Instances = Instances;
Findings.BaseInstances = BaseInstances;
return Findings;
})();
//# sourceMappingURL=findings.mjs.map