UNPKG

n8n-nodes-tenable-community

Version:

n8n node for the Tenable One platform

51 lines (50 loc) 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pciAsvApiRequest = pciAsvApiRequest; async function pciAsvApiRequest(resource, operation, body = {}, qs = {}) { const credentials = await this.getCredentials('tenableApi'); const baseUrl = 'https://cloud.tenable.com'; let endpoint = ''; const method = 'GET'; if (resource === 'attestations') { if (operation === 'list') { endpoint = '/pci-asv/attestations/list'; } else if (operation === 'getDetails') { endpoint = `/pci-asv/attestations/details/${qs.attestation_uuid}`; } else if (operation === 'listDisputes') { endpoint = `/pci-asv/attestations/details/${qs.attestation_uuid}/disputes`; } else if (operation === 'listUndisputedFailures') { endpoint = `/pci-asv/attestations/${qs.attestation_uuid}/failures/undisputed/list`; } else if (operation === 'listAssets') { endpoint = `/pci-asv/attestations/${qs.attestation_uuid}/assets/list`; } } else if (resource === 'pciScans') { if (operation === 'list') { endpoint = '/pci-asv/scans/list'; } } const options = { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'X-ApiKeys': `accessKey=${credentials.accessKey};secretKey=${credentials.secretKey}`, }, method, qs, body, url: `${baseUrl}${endpoint}`, json: true, }; if (Object.keys(body).length === 0) { delete options.body; } if (Object.keys(qs).length === 0) { delete options.qs; } return this.helpers.httpRequest(options); }