n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
33 lines (32 loc) • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyDevice = verifyDevice;
const apiRequest_1 = require("../../../helpers/apiRequest");
const responseFormatter_1 = require("../../../helpers/responseFormatter");
const logger_1 = require("../../../helpers/logger");
async function verifyDevice() {
logger_1.logger.info('inventory:devices:verifyDevice', 'Starting verifyDevice operation');
try {
const mac = this.getNodeParameter('mac', 0);
const serial = this.getNodeParameter('serial', 0);
const partNumber = this.getNodeParameter('partNumber', 0);
const deviceObject = {
mac,
serial,
};
if (partNumber) {
deviceObject.partNumber = partNumber;
}
// The API expects an array of devices, even for single device verification
const requestBody = [deviceObject];
logger_1.logger.debug('inventory:devices:verifyDevice', `Verifying device with MAC: ${mac}, Serial: ${serial}`);
// Make API request
const response = await apiRequest_1.apiRequest.call(this, 'POST', '/platform/device_inventory/v1/devices/verify', requestBody, {});
logger_1.logger.info('inventory:devices:verifyDevice', 'Device verification completed');
return (0, responseFormatter_1.formatResponse)(response);
}
catch (error) {
logger_1.logger.error('inventory:devices:verifyDevice:error', error.message);
throw error;
}
}