UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

76 lines • 2.78 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 BaseScans = /* @__PURE__ */ (() => { class BaseScans extends APIResource { /** * Creates and starts a new vulnerability scan. The response may include non-fatal * warnings in the `messages` array. * * @example * ```ts * const scan = await client.vulnerabilityScanner.scans.create( * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * credential_sets: { * attacker: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * owner: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * }, * open_api: 'open_api', * scan_type: 'bola', * target_environment_id: * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/vuln_scanner/scans`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Returns all scans for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const scanListResponse of client.vulnerabilityScanner.scans.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/vuln_scanner/scans`, (V4PagePaginationArray), { query, ...options }); } /** * Returns a single scan by ID. * * @example * ```ts * const scan = await client.vulnerabilityScanner.scans.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(scanID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/vuln_scanner/scans/${scanID}`, options)._thenUnwrap((obj) => obj.result); } } BaseScans._key = Object.freeze([ 'vulnerabilityScanner', 'scans', ]); return BaseScans; })(); export class Scans extends BaseScans { } //# sourceMappingURL=scans.mjs.map