UNPKG

n8n-nodes-arubacentral

Version:

n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities

45 lines (44 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPools = getPools; const apiRequest_1 = require("../../../../helpers/apiRequest"); const logger_1 = require("../../../../helpers/logger"); const errorHandler_1 = require("../../../../helpers/errorHandler"); const pagination_1 = require("../../../../helpers/pagination"); /** * Get Pools * GET /monitoring/v1/gateways/{serial}/dhcp_pools * * @param this The n8n execution context * @returns Formatted API response */ async function getPools() { try { const returnAll = this.getNodeParameter('returnAll', 0, false); // Get required parameters const serial = this.getNodeParameter('serial', 0); // Construct request options const options = {}; // No query parameters // No body parameters // Construct API endpoint manually to avoid template literal issues const endpoint = '/monitoring/v1/gateways/' + encodeURIComponent(serial) + '/dhcp_pools'; console.log('Constructed endpoint:', endpoint); // Handle pagination if (returnAll) { // Use the handlePagination helper const responseData = await pagination_1.handlePagination.call(this, endpoint, 'GET', {}, // empty body options.qs || {}, { path: ['data'] }, // adjust based on your API's response structure returnAll, this.getNodeParameter('limit', 0, 0)); return responseData; } // Make API request const responseData = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, options); // Format and return response return [{ json: responseData }]; } catch (error) { logger_1.logger.error('monitoring:gateway:getPools:error', { message: error.message }); return errorHandler_1.handleApiError.call(this, error, 'Failed to execute get pools'); } }