UNPKG

n8n-nodes-tenable-community

Version:

n8n node for the Tenable One platform

33 lines (32 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.attackPathAnalysisApiRequest = attackPathAnalysisApiRequest; async function attackPathAnalysisApiRequest(resource, operation, body = {}, qs = {}) { const credentials = await this.getCredentials('tenableApi'); const baseUrl = 'https://cloud.tenable.com'; let endpoint = ''; let method = 'GET'; if (resource === 'attackPath') { if (operation === 'listAttackPaths') { endpoint = '/apa/api/discover/v1/vectors'; } else if (operation === 'listFindings') { endpoint = '/apa/findings-api/v1/findings'; } } const options = { headers: { 'X-ApiKeys': `accessKey=${credentials.accessKey};secretKey=${credentials.secretKey}`, 'Content-Type': 'application/json', }, method, url: `${baseUrl}${endpoint}`, body, qs, json: true, }; if (Object.keys(body).length === 0) { delete options.body; } return this.helpers.httpRequest(options); }