n8n-nodes-arubacentralnextgen
Version:
n8n community node for Aruba Central NextGen API integration with modern monitoring and management capabilities
1,299 lines (1,298 loc) • 62.8 kB
JavaScript
"use strict";
// methods/configuration/vlansNetworks.methods.ts
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.getAllVRRPGlobal = getAllVRRPGlobal;
exports.getVRRPGlobal = getVRRPGlobal;
exports.createVRRPGlobal = createVRRPGlobal;
exports.updateVRRPGlobal = updateVRRPGlobal;
exports.deleteVRRPGlobal = deleteVRRPGlobal;
exports.getAllVRRPInterface = getAllVRRPInterface;
exports.getVRRPInterface = getVRRPInterface;
exports.createVRRPInterface = createVRRPInterface;
exports.updateVRRPInterface = updateVRRPInterface;
exports.deleteVRRPInterface = deleteVRRPInterface;
exports.getAllMVRP = getAllMVRP;
exports.getMVRP = getMVRP;
exports.createMVRP = createMVRP;
exports.updateMVRP = updateMVRP;
exports.deleteMVRP = deleteMVRP;
exports.getAllSmartlink = getAllSmartlink;
exports.getSmartlink = getSmartlink;
exports.createSmartlink = createSmartlink;
exports.updateSmartlink = updateSmartlink;
exports.deleteSmartlink = deleteSmartlink;
exports.getAllSTP = getAllSTP;
exports.getSTP = getSTP;
exports.createSTP = createSTP;
exports.updateSTP = updateSTP;
exports.deleteSTP = deleteSTP;
exports.getAllLayer2VLAN = getAllLayer2VLAN;
exports.getLayer2VLAN = getLayer2VLAN;
exports.createLayer2VLAN = createLayer2VLAN;
exports.updateLayer2VLAN = updateLayer2VLAN;
exports.deleteLayer2VLAN = deleteLayer2VLAN;
exports.getAllVLANRange = getAllVLANRange;
exports.createVLANRange = createVLANRange;
exports.updateVLANRange = updateVLANRange;
exports.deleteVLANRange = deleteVLANRange;
exports.getAllLoopProtect = getAllLoopProtect;
exports.getLoopProtect = getLoopProtect;
exports.createLoopProtect = createLoopProtect;
exports.updateLoopProtect = updateLoopProtect;
exports.deleteLoopProtect = deleteLoopProtect;
exports.getAllNamedVLAN = getAllNamedVLAN;
exports.getNamedVLAN = getNamedVLAN;
exports.createNamedVLAN = createNamedVLAN;
exports.updateNamedVLAN = updateNamedVLAN;
exports.deleteNamedVLAN = deleteNamedVLAN;
const apiRequest_1 = require("../../helpers/apiRequest");
const responseFormatter_1 = require("../../helpers/responseFormatter");
const logger = __importStar(require("../../helpers/logger"));
/**
* VLAN & Network Configuration Methods
* API Reference: https://developer.arubanetworks.com/new-central-config/reference
* Base Path: /network-config/v1alpha1
*
* Resources:
* - VRRP Global (vrrp-global)
* - VRRP Interface (vrrp)
* - MVRP (mvrp)
* - Smartlink (smartlink)
* - STP (stp)
* - Layer2 VLAN (layer2-vlan)
* - VLAN Range (layer2-vlan-range)
* - Loop Protect (loop-protect)
* - Named VLAN (named-vlan)
*/
// ====================================
// VRRP Global Methods
// ====================================
/**
* Get all VRRP Global configurations
*/
async function getAllVRRPGlobal() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllVRRPGlobal operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/vrrp-global';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} VRRP Global configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllVRRPGlobal', error);
throw error;
}
}
/**
* Get a specific VRRP Global configuration
*/
async function getVRRPGlobal() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getVRRPGlobal operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting VRRP Global configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp-global/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getVRRPGlobal', error);
throw error;
}
}
/**
* Create a new VRRP Global configuration
*/
async function createVRRPGlobal() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createVRRPGlobal operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating VRRP Global configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/vrrp-global';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createVRRPGlobal', error);
throw error;
}
}
/**
* Update an existing VRRP Global configuration
*/
async function updateVRRPGlobal() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateVRRPGlobal operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating VRRP Global configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp-global/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateVRRPGlobal', error);
throw error;
}
}
/**
* Delete a VRRP Global configuration
*/
async function deleteVRRPGlobal() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteVRRPGlobal operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
if (debugMode) {
logger.debug('Deleting VRRP Global configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp-global/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'VRRP Global configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteVRRPGlobal', error);
throw error;
}
}
// ====================================
// VRRP Interface Methods
// ====================================
/**
* Get all VRRP Interface configurations
*/
async function getAllVRRPInterface() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllVRRPInterface operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/vrrp';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} VRRP Interface configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllVRRPInterface', error);
throw error;
}
}
/**
* Get a specific VRRP Interface configuration
*/
async function getVRRPInterface() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getVRRPInterface operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting VRRP Interface configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getVRRPInterface', error);
throw error;
}
}
/**
* Create a new VRRP Interface configuration
*/
async function createVRRPInterface() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createVRRPInterface operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating VRRP Interface configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/vrrp';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createVRRPInterface', error);
throw error;
}
}
/**
* Update an existing VRRP Interface configuration
*/
async function updateVRRPInterface() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateVRRPInterface operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating VRRP Interface configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateVRRPInterface', error);
throw error;
}
}
/**
* Delete a VRRP Interface configuration
*/
async function deleteVRRPInterface() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteVRRPInterface operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
if (debugMode) {
logger.debug('Deleting VRRP Interface configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/vrrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'VRRP Interface configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteVRRPInterface', error);
throw error;
}
}
// ====================================
// MVRP Methods
// ====================================
/**
* Get all MVRP configurations
*/
async function getAllMVRP() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllMVRP operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/mvrp';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} MVRP configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllMVRP', error);
throw error;
}
}
/**
* Get a specific MVRP configuration
*/
async function getMVRP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getMVRP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting MVRP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/mvrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getMVRP', error);
throw error;
}
}
/**
* Create a new MVRP configuration
*/
async function createMVRP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createMVRP operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating MVRP configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/mvrp';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createMVRP', error);
throw error;
}
}
/**
* Update an existing MVRP configuration
*/
async function updateMVRP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateMVRP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating MVRP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/mvrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateMVRP', error);
throw error;
}
}
/**
* Delete a MVRP configuration
*/
async function deleteMVRP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteMVRP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
if (debugMode) {
logger.debug('Deleting MVRP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/mvrp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'MVRP configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteMVRP', error);
throw error;
}
}
// ====================================
// Smartlink Methods
// ====================================
/**
* Get all Smartlink configurations
*/
async function getAllSmartlink() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllSmartlink operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/smartlink';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} Smartlink configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllSmartlink', error);
throw error;
}
}
/**
* Get a specific Smartlink configuration
*/
async function getSmartlink() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getSmartlink operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting Smartlink configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/smartlink/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getSmartlink', error);
throw error;
}
}
/**
* Create a new Smartlink configuration
*/
async function createSmartlink() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createSmartlink operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating Smartlink configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/smartlink';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createSmartlink', error);
throw error;
}
}
/**
* Update an existing Smartlink configuration
*/
async function updateSmartlink() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateSmartlink operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating Smartlink configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/smartlink/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateSmartlink', error);
throw error;
}
}
/**
* Delete a Smartlink configuration
*/
async function deleteSmartlink() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteSmartlink operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
if (debugMode) {
logger.debug('Deleting Smartlink configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/smartlink/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'Smartlink configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteSmartlink', error);
throw error;
}
}
// ====================================
// STP Methods
// ====================================
/**
* Get all STP configurations
*/
async function getAllSTP() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllSTP operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/stp';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} STP configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllSTP', error);
throw error;
}
}
/**
* Get a specific STP configuration
*/
async function getSTP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getSTP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting STP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/stp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getSTP', error);
throw error;
}
}
/**
* Create a new STP configuration
*/
async function createSTP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createSTP operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating STP configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/stp';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createSTP', error);
throw error;
}
}
/**
* Update an existing STP configuration
*/
async function updateSTP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateSTP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating STP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/stp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateSTP', error);
throw error;
}
}
/**
* Delete a STP configuration
*/
async function deleteSTP() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteSTP operation', undefined, this);
}
try {
const name = this.getNodeParameter('name', 0);
if (debugMode) {
logger.debug('Deleting STP configuration', { name }, this);
}
const endpoint = `/network-config/v1alpha1/stp/${encodeURIComponent(name)}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'STP configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteSTP', error);
throw error;
}
}
// ====================================
// Layer2 VLAN Methods
// ====================================
/**
* Get all Layer2 VLAN configurations
*/
async function getAllLayer2VLAN() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllLayer2VLAN operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/layer2-vlan';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} Layer2 VLAN configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllLayer2VLAN', error);
throw error;
}
}
/**
* Get a specific Layer2 VLAN configuration
* NOTE: Uses VLAN ID, not name
*/
async function getLayer2VLAN() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getLayer2VLAN operation', undefined, this);
}
try {
const vlanId = this.getNodeParameter('vlanId', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (debugMode) {
logger.debug('Getting Layer2 VLAN configuration', { vlanId }, this);
}
const endpoint = `/network-config/v1alpha1/layer2-vlan/${vlanId}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getLayer2VLAN', error);
throw error;
}
}
/**
* Create a new Layer2 VLAN configuration
*/
async function createLayer2VLAN() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createLayer2VLAN operation', undefined, this);
}
try {
const vlanId = this.getNodeParameter('vlanId', 0);
const vlanName = this.getNodeParameter('vlanName', 0);
const descriptionAlias = this.getNodeParameter('descriptionAlias', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
// Build the request body
const body = {
vlan: vlanId,
};
if (vlanName) {
body.name = vlanName;
}
if (descriptionAlias) {
body['description-alias'] = descriptionAlias;
}
// Add additional fields
if (additionalFields.enable !== undefined) {
body.enable = additionalFields.enable;
}
if (additionalFields.vrf) {
body.vrf = additionalFields.vrf;
}
if (additionalFields.qinqSvlan !== undefined) {
body['qinq-svlan'] = additionalFields.qinqSvlan;
}
if (additionalFields.voiceEnableAlias) {
body['voice-enable-alias'] = additionalFields.voiceEnableAlias;
}
// Build query parameters
const queryParams = {};
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (debugMode) {
logger.debug('Creating Layer2 VLAN configuration', { vlanId, body, queryParams }, this);
}
const endpoint = `/network-config/v1alpha1/layer2-vlan/${encodeURIComponent(vlanId)}`;
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createLayer2VLAN', error);
throw error;
}
}
/**
* Update an existing Layer2 VLAN configuration
* NOTE: Uses VLAN ID, not name
*/
async function updateLayer2VLAN() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateLayer2VLAN operation', undefined, this);
}
try {
const vlanId = this.getNodeParameter('vlanId', 0);
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating Layer2 VLAN configuration', { vlanId }, this);
}
const endpoint = `/network-config/v1alpha1/layer2-vlan/${vlanId}`;
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateLayer2VLAN', error);
throw error;
}
}
/**
* Delete a Layer2 VLAN configuration
* NOTE: Uses VLAN ID, not name
*/
async function deleteLayer2VLAN() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteLayer2VLAN operation', undefined, this);
}
try {
const vlanId = this.getNodeParameter('vlanId', 0);
if (debugMode) {
logger.debug('Deleting Layer2 VLAN configuration', { vlanId }, this);
}
const endpoint = `/network-config/v1alpha1/layer2-vlan/${vlanId}`;
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, {}, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'Layer2 VLAN configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteLayer2VLAN', error);
throw error;
}
}
// ====================================
// VLAN Range Methods
// ====================================
/**
* Get all VLAN Range configurations
*/
async function getAllVLANRange() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllVLANRange operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/layer2-vlan-range';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} VLAN Range configurations`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllVLANRange', error);
throw error;
}
}
/**
* Create a new VLAN Range configuration
*/
async function createVLANRange() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting createVLANRange operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Creating VLAN Range configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/layer2-vlan-range';
const response = await apiRequest_1.apiRequest.call(this, 'POST', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in createVLANRange', error);
throw error;
}
}
/**
* Update an existing VLAN Range configuration
*/
async function updateVLANRange() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting updateVLANRange operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Updating VLAN Range configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/layer2-vlan-range';
const response = await apiRequest_1.apiRequest.call(this, 'PATCH', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in updateVLANRange', error);
throw error;
}
}
/**
* Delete a VLAN Range configuration
*/
async function deleteVLANRange() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting deleteVLANRange operation', undefined, this);
}
try {
const configurationData = this.getNodeParameter('configurationData', 0);
const body = JSON.parse(configurationData);
if (debugMode) {
logger.debug('Deleting VLAN Range configuration', { body }, this);
}
const endpoint = '/network-config/v1alpha1/layer2-vlan-range';
const response = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint, body, {});
return responseFormatter_1.formatResponse.call(this, response || { success: true, message: 'VLAN Range configuration deleted successfully' });
}
catch (error) {
logger.error('Error in deleteVLANRange', error);
throw error;
}
}
// ====================================
// Loop Protect Methods
// ====================================
/**
* Get all Loop Protect configurations
*/
async function getAllLoopProtect() {
var _a, _b;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllLoopProtect operation', undefined, this);
}
try {
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
const queryParams = {};
if (additionalFields.viewType) {
queryParams.view_type = additionalFields.viewType;
}
if (additionalFields.objectType) {
queryParams.object_type = additionalFields.objectType;
}
if (additionalFields.scopeId) {
queryParams.scope_id = additionalFields.scopeId;
}
if (additionalFields.persona) {
queryParams.persona = additionalFields.persona;
}
if (additionalFields.effective !== undefined) {
queryParams.effective = additionalFields.effective;
}
if (additionalFields.detailed !== undefined) {
queryParams.detailed = additionalFields.detailed;
}
if (additionalFields.limit) {
queryParams.limit = additionalFields.limit;
}
if (additionalFields.offset !== undefined) {
queryParams.offset = additionalFields.offset;
}
if (debugMode) {
logger.debug('Query parameters', queryParams, this);
}
const endpoint = '/network-config/v1alpha1/loop-protect';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug(`Retrieved ${((_a = response.items) === null || _a === void 0 ? void 0 : _a.length) || ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) || 0} Loop Protect configurations`, undefined, this);
}