n8n-nodes-arubaclearpass
Version:
n8n community node for Aruba ClearPass API integration with comprehensive identity, policy, and enforcement profile management
84 lines (83 loc) • 3.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.listServerConfigurations = listServerConfigurations;
exports.getServerConfiguration = getServerConfiguration;
exports.updateServerConfiguration = updateServerConfiguration;
// methods/LocalServerConfiguration/ServerConfiguration.methods.ts
const n8n_workflow_1 = require("n8n-workflow");
const apiRequest_1 = require("../../helpers/apiRequest");
const responseFormatter_1 = require("../../helpers/responseFormatter");
/**
* Get a list of all servers in the cluster
* GET /cluster/server
*/
async function listServerConfigurations() {
try {
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', '/cluster/server');
return responseFormatter_1.formatResponse.call(this, responseData);
}
catch (error) {
const errorObject = {};
if (error instanceof Error) {
errorObject.message = error.message;
if (error.stack)
errorObject.stackTrace = error.stack;
}
else {
errorObject.message = 'Unknown error in listServerConfigurations';
}
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
}
}
/**
* Get configuration for a specific server
* GET /cluster/server/{uuid}
* uuid can be a server UUID, "publisher", or "this"
*/
async function getServerConfiguration() {
try {
const serverUuid = this.getNodeParameter('serverUuid', 0);
const responseData = await apiRequest_1.apiRequest.call(this, 'GET', `/cluster/server/${encodeURIComponent(serverUuid)}`);
return responseFormatter_1.formatResponse.call(this, responseData);
}
catch (error) {
const errorObject = {};
if (error instanceof Error) {
errorObject.message = error.message;
if (error.stack)
errorObject.stackTrace = error.stack;
}
else {
errorObject.message = 'Unknown error in getServerConfiguration';
}
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
}
}
/**
* Update configuration of a specific server
* PATCH /cluster/server/{uuid}
* uuid can be a server UUID, "publisher", or "this"
*/
async function updateServerConfiguration() {
try {
const serverUuid = this.getNodeParameter('serverUuid', 0);
const isInsightEnabled = this.getNodeParameter('is_insight_enabled', 0);
const body = {
is_insight_enabled: isInsightEnabled,
};
const responseData = await apiRequest_1.apiRequest.call(this, 'PATCH', `/cluster/server/${encodeURIComponent(serverUuid)}`, body);
return responseFormatter_1.formatResponse.call(this, responseData);
}
catch (error) {
const errorObject = {};
if (error instanceof Error) {
errorObject.message = error.message;
if (error.stack)
errorObject.stackTrace = error.stack;
}
else {
errorObject.message = 'Unknown error in updateServerConfiguration';
}
throw new n8n_workflow_1.NodeApiError(this.getNode(), errorObject);
}
}