cloudflare
Version:
The official TypeScript library for the Cloudflare API
113 lines • 4.78 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../../../core/pagination.mjs";
import { path } from "../../../../../internal/utils/path.mjs";
export var BaseInstances = /* @__PURE__ */ (() => {
class BaseInstances extends APIResource {
/**
* Lists all security finding instances for a given security finding.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const instanceListResponse of client.zeroTrust.casb.posture.findings.instances.list(
* 'U3RhaW5sZXNzIHJvY2tz',
* { account_id: '46148281d8a93d002ef242d8b0d5f9f6' },
* )) {
* // ...
* }
* ```
*/
list(findingID, params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/data-security/posture/findings/${findingID}/instances`, (V4PagePaginationArray), { query, ...options });
}
/**
* Archive one or more finding instances.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.instances.archive(
* 'U3RhaW5sZXNzIHJvY2tz',
* {
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* check_instances: [
* '497f6eca-6276-4993-bfeb-53cbbbba6f08',
* ],
* },
* );
* ```
*/
archive(findingID, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/data-security/posture/findings/${findingID}/instances/archive`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Creates a CSV export for Finding instances and accepts optional filters in the
* payload.
*
* Identify the finding as `<integration_id>-<finding_type_id>`: join the
* `integration.id` and `finding.id` of the finding (from the List posture findings
* response) with a hyphen.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.instances.export(
* '00000000-0000-0000-0000-000000000001-00000000-0000-0000-0000-000000000002',
* { account_id: '46148281d8a93d002ef242d8b0d5f9f6' },
* );
* ```
*/
export(storageNamespaceID, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/data-security/posture/findings/${storageNamespaceID}/instances/export`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Gets a security Finding instance by id.
*
* @example
* ```ts
* const instance =
* await client.zeroTrust.casb.posture.findings.instances.get(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* finding_id: 'U3RhaW5sZXNzIHJvY2tz',
* },
* );
* ```
*/
get(instanceID, params, options) {
const { account_id, finding_id } = params;
return this._client.get(path `/accounts/${account_id}/data-security/posture/findings/${finding_id}/instances/${instanceID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Remove the archive marking from one or more finding instances.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.casb.posture.findings.instances.unarchive(
* 'U3RhaW5sZXNzIHJvY2tz',
* {
* account_id: '46148281d8a93d002ef242d8b0d5f9f6',
* check_instances: [
* '497f6eca-6276-4993-bfeb-53cbbbba6f08',
* ],
* },
* );
* ```
*/
unarchive(findingID, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/data-security/posture/findings/${findingID}/instances/unarchive`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
}
BaseInstances._key = Object.freeze(['zeroTrust', 'casb', 'posture', 'findings', 'instances']);
return BaseInstances;
})();
export class Instances extends BaseInstances {
}
//# sourceMappingURL=instances.mjs.map