n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
32 lines (31 loc) • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.archiveDevices = archiveDevices;
const apiRequest_1 = require("../../../helpers/apiRequest");
const responseFormatter_1 = require("../../../helpers/responseFormatter");
const logger_1 = require("../../../helpers/logger");
async function archiveDevices() {
logger_1.logger.info('inventory:devices:archiveDevices', 'Starting archiveDevices operation');
try {
const serialsString = this.getNodeParameter('serials', 0);
const serials = serialsString
.split(',')
.map((s) => s.trim())
.filter((s) => s.length > 0);
if (serials.length === 0) {
throw new Error('At least one serial number must be provided');
}
const requestBody = {
serials,
};
logger_1.logger.debug('inventory:devices:archiveDevices', `Archiving ${serials.length} devices: ${serials.join(', ')}`);
// Make API request
const response = await apiRequest_1.apiRequest.call(this, 'POST', '/platform/device_inventory/v1/devices/archive', requestBody, {});
logger_1.logger.info('inventory:devices:archiveDevices', 'Devices archived successfully');
return (0, responseFormatter_1.formatResponse)(response);
}
catch (error) {
logger_1.logger.error('inventory:devices:archiveDevices:error', error.message);
throw error;
}
}