n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
39 lines (38 loc) • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCxSwitchPoeInfo = getCxSwitchPoeInfo;
const apiRequest_1 = require("../../../../helpers/apiRequest");
const logger_1 = require("../../../../helpers/logger");
const errorHandler_1 = require("../../../../helpers/errorHandler");
/**
* Get Switch PoE Info for CX Switch
*
* GET /monitoring/v1/cx_switches/{serial}/poe_details
*
* @param this The n8n execution context
* @returns Formatted API response
*/
async function getCxSwitchPoeInfo() {
try {
// Get parameters
const serial = this.getNodeParameter('serial', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
// Construct query parameters
const qs = {};
// Add port parameter if provided
if (additionalFields.port !== undefined && additionalFields.port !== '') {
qs.port = additionalFields.port;
}
logger_1.logger.debug('monitoring:switch:getCxSwitchPoeInfo', `Getting PoE info for CX switch with serial: ${serial}${additionalFields.port ? ', port: ' + additionalFields.port : ''}`);
// Make API request
const endpoint = `/monitoring/v1/cx_switches/${encodeURIComponent(serial)}/poe_details`;
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, qs);
logger_1.logger.debug('monitoring:switch:getCxSwitchPoeInfo', 'Successfully retrieved CX switch PoE info');
// Return formatted response
return [{ json: responseData }];
}
catch (error) {
logger_1.logger.error('monitoring:switch:getCxSwitchPoeInfo:error', { message: error.message });
return errorHandler_1.handleApiError.call(this, error, 'Failed to get CX switch PoE info');
}
}