UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

75 lines • 2.94 kB
// 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 BaseJobs = /* @__PURE__ */ (() => { class BaseJobs extends APIResource { /** * Create one or more remediation jobs tied to a specific Cloudflare Account. * * @example * ```ts * const job = * await client.zeroTrust.casb.posture.remediations.jobs.create( * { * account_id: '46148281d8a93d002ef242d8b0d5f9f6', * finding_instance_ids: [ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * ], * remediation_type_id: * '5a7d9e2f-1b3c-4d5e-8f6a-7b8c9d0e1f2a', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/data-security/posture/remediations/jobs`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List all remediation jobs tied to a specific Cloudflare Account. Note that * `cursor` and `page` are mutually exclusive. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const jobListResponse of client.zeroTrust.casb.posture.remediations.jobs.list( * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/data-security/posture/remediations/jobs`, (V4PagePaginationArray), { query, ...options }); } /** * Creates a CSV export for remediation jobs and accepts optional filters in the * payload. * * @example * ```ts * const response = * await client.zeroTrust.casb.posture.remediations.jobs.export( * { account_id: '46148281d8a93d002ef242d8b0d5f9f6' }, * ); * ``` */ export(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/data-security/posture/remediations/jobs/export`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseJobs._key = Object.freeze(['zeroTrust', 'casb', 'posture', 'remediations', 'jobs']); return BaseJobs; })(); export class Jobs extends BaseJobs { } //# sourceMappingURL=jobs.mjs.map