UNPKG

n8n-nodes-arubaclearpass

Version:

n8n community node for Aruba ClearPass API integration with comprehensive identity, policy, and enforcement profile management

202 lines (201 loc) 10.7 kB
"use strict"; 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.executeOperation = executeOperation; const deviceMethods = __importStar(require("../methods/Identities/Device.methods")); const endpointMethods = __importStar(require("../methods/Identities/Endpoint.methods")); const guestUserMethods = __importStar(require("../methods/Identities/GuestUser.methods")); const localUserMethods = __importStar(require("../methods/Identities/LocalUser.methods")); const roleMethods = __importStar(require("../methods/PolicyElements/Role.methods")); const roleMappingMethods = __importStar(require("../methods/PolicyElements/RoleMapping.methods")); const enforcementPolicyMethods = __importStar(require("../methods/PolicyElements/EnforcementPolicy.methods")); const enforcementProfileMethods = __importStar(require("../methods/EnforcementProfile/EnforcementProfile.methods")); const serviceCertMethods = __importStar(require("../methods/PlatformCertificates/ServiceCert.methods")); const serverCertMethods = __importStar(require("../methods/PlatformCertificates/ServerCert.methods")); const selfSignedCertMethods = __importStar(require("../methods/PlatformCertificates/SelfSignedCert.methods")); const cppmVersionMethods = __importStar(require("../methods/LocalServerConfiguration/CppmVersion.methods")); const serverVersionMethods = __importStar(require("../methods/LocalServerConfiguration/ServerVersion.methods")); const serverConfigurationMethods = __importStar(require("../methods/LocalServerConfiguration/ServerConfiguration.methods")); /** * Execute the appropriate operation based on user selection */ async function executeOperation() { const domain = this.getNodeParameter('domain', 0); const resource = this.getNodeParameter('resource', 0); const operation = this.getNodeParameter('operation', 0); console.log(`Executing ${domain}.${resource}.${operation}`); // Define handlers for each domain/resource/operation combination const handlers = { Identities: { Device: { list: deviceMethods.listDevices, get: deviceMethods.getDevice, getByMac: deviceMethods.getDeviceByMac, create: deviceMethods.createDevice, update: deviceMethods.updateDevice, updateByMac: deviceMethods.updateDeviceByMac, replace: deviceMethods.replaceDevice, replaceByMac: deviceMethods.replaceDeviceByMac, delete: deviceMethods.deleteDevice, deleteByMac: deviceMethods.deleteDeviceByMac, }, Endpoint: { list: endpointMethods.listEndpoints, get: endpointMethods.getEndpoint, getByMac: endpointMethods.getEndpointByMac, create: endpointMethods.createEndpoint, update: endpointMethods.updateEndpoint, updateByMac: endpointMethods.updateEndpointByMac, delete: endpointMethods.deleteEndpoint, deleteByMac: endpointMethods.deleteEndpointByMac, }, GuestUser: { // Add this section for GuestUser operations list: guestUserMethods.listGuestUsers, get: guestUserMethods.getGuestUser, getByUsername: guestUserMethods.getGuestUserByUsername, create: guestUserMethods.createGuestUser, update: guestUserMethods.updateGuestUser, updateByUsername: guestUserMethods.updateGuestUserByUsername, replace: guestUserMethods.replaceGuestUser, replaceByUsername: guestUserMethods.replaceGuestUserByUsername, delete: guestUserMethods.deleteGuestUser, deleteByUsername: guestUserMethods.deleteGuestUserByUsername, }, LocalUser: { list: localUserMethods.listLocalUsers, get: localUserMethods.getLocalUser, getByUserId: localUserMethods.getLocalUserByUserId, create: localUserMethods.createLocalUser, update: localUserMethods.updateLocalUser, updateByUserId: localUserMethods.updateLocalUserByUserId, replace: localUserMethods.replaceLocalUser, replaceByUserId: localUserMethods.replaceLocalUserByUserId, delete: localUserMethods.deleteLocalUser, deleteByUserId: localUserMethods.deleteLocalUserByUserId, }, }, PolicyElements: { Role: { list: roleMethods.listRoles, get: roleMethods.getRole, getByName: roleMethods.getRoleByName, create: roleMethods.createRole, update: roleMethods.updateRole, updateByName: roleMethods.updateRoleByName, replace: roleMethods.replaceRole, replaceByName: roleMethods.replaceRoleByName, delete: roleMethods.deleteRole, deleteByName: roleMethods.deleteRoleByName, }, RoleMapping: { list: roleMappingMethods.listRoleMappings, get: roleMappingMethods.getRoleMapping, getByName: roleMappingMethods.getRoleMappingByName, create: roleMappingMethods.createRoleMapping, update: roleMappingMethods.updateRoleMapping, updateByName: roleMappingMethods.updateRoleMappingByName, replace: roleMappingMethods.replaceRoleMapping, replaceByName: roleMappingMethods.replaceRoleMappingByName, delete: roleMappingMethods.deleteRoleMapping, deleteByName: roleMappingMethods.deleteRoleMappingByName, }, EnforcementPolicy: { list: enforcementPolicyMethods.listEnforcementPolicies, get: enforcementPolicyMethods.getEnforcementPolicy, getByName: enforcementPolicyMethods.getEnforcementPolicyByName, create: enforcementPolicyMethods.createEnforcementPolicy, update: enforcementPolicyMethods.updateEnforcementPolicy, updateByName: enforcementPolicyMethods.updateEnforcementPolicyByName, replace: enforcementPolicyMethods.replaceEnforcementPolicy, replaceByName: enforcementPolicyMethods.replaceEnforcementPolicyByName, delete: enforcementPolicyMethods.deleteEnforcementPolicy, deleteByName: enforcementPolicyMethods.deleteEnforcementPolicyByName, }, // Add other PolicyElements resources as needed }, EnforcementProfile: { EnforcementProfile: { list: enforcementProfileMethods.listEnforcementProfiles, get: enforcementProfileMethods.getEnforcementProfile, getByName: enforcementProfileMethods.getEnforcementProfileByName, create: enforcementProfileMethods.createEnforcementProfile, update: enforcementProfileMethods.updateEnforcementProfile, updateByName: enforcementProfileMethods.updateEnforcementProfileByName, replace: enforcementProfileMethods.replaceEnforcementProfile, replaceByName: enforcementProfileMethods.replaceEnforcementProfileByName, delete: enforcementProfileMethods.deleteEnforcementProfile, deleteByName: enforcementProfileMethods.deleteEnforcementProfileByName, }, }, PlatformCertificates: { ServiceCert: { list: serviceCertMethods.listServiceCerts, get: serviceCertMethods.getServiceCert, upload: serviceCertMethods.uploadServiceCert, delete: serviceCertMethods.deleteServiceCert, }, ServerCert: { list: serverCertMethods.listServerCerts, getByServiceId: serverCertMethods.getServerCertByServiceId, getByServiceName: serverCertMethods.getServerCertByServiceName, replaceByServiceId: serverCertMethods.replaceServerCertByServiceId, replaceByServiceName: serverCertMethods.replaceServerCertByServiceName, enable: serverCertMethods.enableServerCert, disable: serverCertMethods.disableServerCert, }, SelfSignedCert: { create: selfSignedCertMethods.createSelfSignedCert, }, }, LocalServerConfiguration: { CppmVersion: { get: cppmVersionMethods.getCppmVersion, }, ServerVersion: { get: serverVersionMethods.getServerVersion, }, ServerConfiguration: { list: serverConfigurationMethods.listServerConfigurations, get: serverConfigurationMethods.getServerConfiguration, update: serverConfigurationMethods.updateServerConfiguration, }, }, }; if (!handlers[domain] || !handlers[domain][resource] || !handlers[domain][resource][operation]) { throw new Error(`The operation ${domain}.${resource}.${operation} is not supported!`); } return await handlers[domain][resource][operation].call(this); }