n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
40 lines (34 loc) • 1.29 kB
text/typescript
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { apiRequest } from '../../../../helpers/apiRequest';
import { logger } from '../../../../helpers/logger';
import { handleApiError } from '../../../../helpers/errorHandler';
/**
* Get Switch VSX Info for CX Switch
*
* GET /monitoring/v1/cx_switches/{serial}/vsx
*
* @param this The n8n execution context
* @returns Formatted API response
*/
export async function getCxSwitchVsxInfo(this: IExecuteFunctions): Promise<INodeExecutionData[]> {
try {
// Get parameters
const serial = this.getNodeParameter('serial', 0) as string;
logger.debug(
'monitoring:switch:getCxSwitchVsxInfo',
`Getting VSX info for CX switch with serial: ${serial}`,
);
// Make API request
const endpoint = `/monitoring/v1/cx_switches/${encodeURIComponent(serial)}/vsx`;
const responseData = await apiRequest.call(this, 'GET', endpoint);
logger.debug(
'monitoring:switch:getCxSwitchVsxInfo',
'Successfully retrieved CX switch VSX info',
);
// Return formatted response
return [{ json: responseData }];
} catch (error) {
logger.error('monitoring:switch:getCxSwitchVsxInfo:error', { message: error.message });
return handleApiError.call(this, error, 'Failed to get CX switch VSX info');
}
}