cloudflare
Version:
The official TypeScript library for the Cloudflare API
96 lines • 4.18 kB
JavaScript
;
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 headers_1 = require("../../../internal/headers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseScans = /* @__PURE__ */ (() => {
class BaseScans extends resource_1.APIResource {
/**
* Submits repository intent for operator review. This endpoint does not
* immediately start execution. Worker-imported repositories must be ready;
* explicit `repo_hosts` must be authorized before the request is persisted.
*
* @example
* ```ts
* const scan =
* await client.managedDefense.vulnerabilityDiscovery.scans.create(
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* repos: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
* },
* );
* ```
*/
create(params, options) {
const { account_id, 'Idempotency-Key': idempotencyKey, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
options?.headers,
]),
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists customer-requested scans across review and execution lifecycle states.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const scanListResponse of client.managedDefense.vulnerabilityDiscovery.scans.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans`, (pagination_1.CursorLimitPagination), { query, ...options });
}
/**
* Gets one customer-requested scan across its review and execution lifecycle.
*
* @example
* ```ts
* const scan =
* await client.managedDefense.vulnerabilityDiscovery.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}/managed-defense/vulnerability-discovery/scans/${scanID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets the active operator-reviewed scan report. Repository metadata records
* report readiness even when no publication is available.
*
* @example
* ```ts
* const response =
* await client.managedDefense.vulnerabilityDiscovery.scans.getReport(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
getReport(scanID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/managed-defense/vulnerability-discovery/scans/${scanID}/report`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseScans._key = Object.freeze(['managedDefense', 'vulnerabilityDiscovery', 'scans']);
return BaseScans;
})();
exports.BaseScans = BaseScans;
class Scans extends BaseScans {
}
exports.Scans = Scans;
//# sourceMappingURL=scans.js.map