UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

81 lines • 3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Scans = exports.BaseScans = 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 BaseScans = /* @__PURE__ */ (() => { class BaseScans extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/vuln_scanner/scans`, (pagination_1.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((0, path_1.path) `/accounts/${account_id}/vuln_scanner/scans/${scanID}`, options)._thenUnwrap((obj) => obj.result); } } BaseScans._key = Object.freeze([ 'vulnerabilityScanner', 'scans', ]); return BaseScans; })(); exports.BaseScans = BaseScans; class Scans extends BaseScans { } exports.Scans = Scans; //# sourceMappingURL=scans.js.map