UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

118 lines • 5.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Instances = exports.BaseInstances = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../../core/resource.js"); const pagination_1 = require("../../../../../core/pagination.js"); const path_1 = require("../../../../../internal/utils/path.js"); var BaseInstances = /* @__PURE__ */ (() => { class BaseInstances extends resource_1.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((0, path_1.path) `/accounts/${account_id}/data-security/posture/findings/${findingID}/instances`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.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; })(); exports.BaseInstances = BaseInstances; class Instances extends BaseInstances { } exports.Instances = Instances; //# sourceMappingURL=instances.js.map