UNPKG

n8n-nodes-binalyze-air

Version:

Binalyze AIR nodes for automating DFIR with n8n workflows

62 lines 3.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.api = void 0; const helpers_1 = require("../../utils/helpers"); exports.api = { async getAssets(context, credentials, organizationIds = '0', queryParams) { const orgIds = Array.isArray(organizationIds) ? organizationIds.join(',') : organizationIds; const qs = { 'filter[organizationIds]': orgIds }; if (queryParams) { Object.assign(qs, queryParams); } const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', '/api/public/assets', qs); return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'fetch assets'); }, async getAssetById(context, credentials, id) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', `/api/public/assets/${id}`); return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, `fetch asset with ID ${id}`); }, async getAssetTasks(context, credentials, id, queryParams) { const qs = {}; if (queryParams) { Object.entries(queryParams).forEach(([key, value]) => { if (Array.isArray(value)) { qs[key] = value.join(','); } else { qs[key] = value; } }); } const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'GET', `/api/public/assets/${id}/tasks`, qs); return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, `fetch tasks for asset ${id}`); }, async addTagsToAssets(context, credentials, data) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/assets/tags'); options.body = data; return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'add tags to assets'); }, async removeTagsFromAssets(context, credentials, data) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'DELETE', '/api/public/assets/tags'); options.body = data; return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'remove tags from assets'); }, async rebootAssets(context, credentials, data) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/assets/tasks/reboot'); options.body = data; return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'reboot assets'); }, async shutdownAssets(context, credentials, data) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/assets/tasks/shutdown'); options.body = data; return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'shutdown assets'); }, async setIsolationOnAssets(context, credentials, data) { const options = (0, helpers_1.buildRequestOptionsWithErrorHandling)(credentials, 'POST', '/api/public/assets/tasks/isolation'); options.body = data; return (0, helpers_1.makeApiRequestWithErrorHandling)(context, options, 'set isolation on assets'); } }; //# sourceMappingURL=assets.js.map