UNPKG

n8n-nodes-arubacentralnextgen

Version:

n8n community node for Aruba Central NextGen API integration with modern monitoring and management capabilities

115 lines (114 loc) 4.64 kB
"use strict"; // methods/configuration/configHealth.methods.ts // Configuration Health Operations for Aruba Central NextGen API var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.getActiveIssues = getActiveIssues; exports.getConfigHealthDevices = getConfigHealthDevices; const apiRequest_1 = require("../../helpers/apiRequest"); const responseFormatter_1 = require("../../helpers/responseFormatter"); const logger = __importStar(require("../../helpers/logger")); /** * Configuration Health Methods * API Reference: https://developer.arubanetworks.com/new-central-config/reference * Base Path: /network-config/v1alpha1/config-health * * Operations: * - Get Active Issues: Returns active configuration issues for a specific device * - Get Config Health Devices: Returns configuration health summary for all devices */ // ==================================== // Configuration Health Methods // ==================================== /** * Get Active Issues * Returns active configuration issues for a specific device * Endpoint: GET /network-config/v1alpha1/config-health/active-issue * Required: serial (device serial number) */ async function getActiveIssues() { const debugMode = logger.isDebugMode(this); if (debugMode) logger.debug('Starting getActiveIssues operation', undefined, this); try { const serial = this.getNodeParameter('serial', 0); const queryParams = { serial, }; if (debugMode) { logger.debug('getActiveIssues parameters', { serial }, this); } const response = await apiRequest_1.apiRequest.call(this, 'GET', '/network-config/v1alpha1/config-health/active-issue', {}, queryParams); return responseFormatter_1.formatResponse.call(this, response); } catch (error) { logger.error('Error in getActiveIssues', error); throw error; } } /** * Get Config Health Devices * Returns configuration health summary for all devices * Endpoint: GET /network-config/v1alpha1/config-health/devices * Required: limit, offset * Optional: sort, filter, search */ async function getConfigHealthDevices() { const debugMode = logger.isDebugMode(this); if (debugMode) logger.debug('Starting getConfigHealthDevices operation', undefined, this); try { const additionalFields = this.getNodeParameter('additionalFields', 0, {}); const queryParams = { limit: additionalFields.limit || 100, offset: additionalFields.offset || 0, }; if (additionalFields.sort) queryParams.sort = additionalFields.sort; if (additionalFields.filter) queryParams.filter = additionalFields.filter; if (additionalFields.search) queryParams.search = additionalFields.search; if (debugMode) { logger.debug('getConfigHealthDevices parameters', { queryParams }, this); } const response = await apiRequest_1.apiRequest.call(this, 'GET', '/network-config/v1alpha1/config-health/devices', {}, queryParams); return responseFormatter_1.formatResponse.call(this, response); } catch (error) { logger.error('Error in getConfigHealthDevices', error); throw error; } }