n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
36 lines (35 loc) • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClientMatchInfo = getClientMatchInfo;
const apiRequest_1 = require("../../../../helpers/apiRequest");
const logger_1 = require("../../../../helpers/logger");
const errorHandler_1 = require("../../../../helpers/errorHandler");
/**
* Get Client Match Info
* GET /cm-api/ap/{serial}/client-match/client-info
*
* @param this The n8n execution context
* @returns Formatted API response
*/
async function getClientMatchInfo() {
var _a;
try {
// Get parameters
const serial = this.getNodeParameter('serial', 0);
// Construct API endpoint
const endpoint = '/cm-api/ap/' + encodeURIComponent(serial) + '/client-match/client-info';
logger_1.logger.debug('monitoring:ap:getClientMatchInfo', `Requesting: ${endpoint}`);
// Make API request
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {});
// Format and return response
return [{ json: responseData }];
}
catch (error) {
logger_1.logger.error('monitoring:ap:getClientMatchInfo:error', { message: error.message });
// Handle 404 specifically for ClientMatch APIs which may not be available on all clusters
if (error.httpCode === 404 || ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('404'))) {
return errorHandler_1.handleApiError.call(this, error, 'ClientMatch API not available on this cluster or AP does not support ClientMatch. This is an undocumented API that may not be enabled for all devices.');
}
return errorHandler_1.handleApiError.call(this, error, 'Failed to get client match info');
}
}