n8n-nodes-arubaclearpass
Version:
n8n community node for Aruba ClearPass API integration with comprehensive identity, policy, and enforcement profile management
366 lines (365 loc) • 11.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.roleMappingProperties = exports.roleMappingFields = exports.roleMappingOperations = void 0;
// Define operations for RoleMapping resource
exports.roleMappingOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new role mapping',
action: 'Create a role mapping',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a role mapping',
action: 'Delete a role mapping',
},
{
name: 'Get',
value: 'get',
description: 'Get a role mapping by ID',
action: 'Get a role mapping',
},
{
name: 'Get By Name',
value: 'getByName',
description: 'Get a role mapping by name',
action: 'Get a role mapping by name',
},
{
name: 'List',
value: 'list',
description: 'Get all role mappings',
action: 'List all role mappings',
},
{
name: 'Update',
value: 'update',
description: 'Update a role mapping',
action: 'Update a role mapping',
},
{
name: 'Replace',
value: 'replace',
description: 'Replace a role mapping',
action: 'Replace a role mapping',
},
{
name: 'Delete By Name',
value: 'deleteByName',
description: 'Delete a role mapping by name',
action: 'Delete a role mapping by name',
},
{
name: 'Update By Name',
value: 'updateByName',
description: 'Update a role mapping by name',
action: 'Update a role mapping by name',
},
{
name: 'Replace By Name',
value: 'replaceByName',
description: 'Replace a role mapping by name',
action: 'Replace a role mapping by name',
},
],
default: 'list',
};
// Define fields for RoleMapping resource
exports.roleMappingFields = [
// Fields for ID-based operations
{
displayName: 'Role Mapping ID',
name: 'roleMappingId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['get', 'update', 'delete', 'replace'],
},
},
description: 'The ID of the role mapping',
},
// Fields for name-based operations
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['getByName', 'deleteByName', 'updateByName', 'replaceByName'],
},
},
description: 'The unique name of the role mapping',
},
// Common fields for create and replace operations
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['create', 'replace', 'replaceByName'],
},
},
description: 'Name of the role mapping policy',
},
{
displayName: 'Default Role Name',
name: 'default_role_name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['create', 'replace', 'replaceByName'],
},
},
description: 'Default role name for the role mapping',
},
{
displayName: 'Rule Combine Algorithm',
name: 'rule_combine_algo',
type: 'options',
options: [
{
name: 'First Applicable',
value: 'first-applicable',
description: 'Stop processing once a rule matches',
},
{
name: 'Evaluate All',
value: 'evaluate-all',
description: 'Process all rules regardless of matches',
},
],
required: true,
default: 'first-applicable',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['create', 'replace', 'replaceByName'],
},
},
description: 'Algorithm to use when evaluating rules',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
required: false,
default: '',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['create', 'replace', 'replaceByName'],
},
},
description: 'Description of the role mapping',
},
// Rules JSON Field for create/replace - This is complex, so we'll use JSON input
{
displayName: 'Rules',
name: 'rules',
type: 'json',
required: true,
default: '[]',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['create', 'replace', 'replaceByName'],
},
},
description: 'JSON array of mapping rules. Each rule should have match_type, role_name, and condition properties.',
placeholder: `[
{
"match_type": "AND",
"role_name": "Guest",
"condition": {
"type": "Connection",
"name": "Connection:Protocol",
"oper": "EQUALS",
"value": "MAC"
}
}
]`,
},
// Update fields
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['update', 'updateByName'],
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the role mapping policy',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the role mapping',
},
{
displayName: 'Default Role Name',
name: 'default_role_name',
type: 'string',
default: '',
description: 'Default role name for the role mapping',
},
{
displayName: 'Rule Combine Algorithm',
name: 'rule_combine_algo',
type: 'options',
options: [
{
name: 'First Applicable',
value: 'first-applicable',
description: 'Stop processing once a rule matches',
},
{
name: 'Evaluate All',
value: 'evaluate-all',
description: 'Process all rules regardless of matches',
},
],
default: 'first-applicable',
description: 'Algorithm to use when evaluating rules',
},
{
displayName: 'Rules',
name: 'rules',
type: 'json',
default: '[]',
description: 'JSON array of mapping rules. Each rule should have match_type, role_name, and condition properties.',
placeholder: `[
{
"match_type": "AND",
"role_name": "Guest",
"condition": {
"type": "Connection",
"name": "Connection:Protocol",
"oper": "EQUALS",
"value": "MAC"
}
}
]`,
},
],
},
// Fields for list operation
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['list'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['list'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['PolicyElements'],
resource: ['RoleMapping'],
operation: ['list'],
},
},
options: [
{
displayName: 'Filter',
name: 'filter',
type: 'string',
default: '',
description: 'JSON filter expression specifying the items to return',
placeholder: '{"name": {"$contains": "Guest"}}',
},
{
displayName: 'Sort',
name: 'sort',
type: 'string',
default: '+id',
description: 'Sort ordering for returned items (default +id)',
placeholder: '+name or -created_at',
},
{
displayName: 'Calculate Count',
name: 'calculate_count',
type: 'boolean',
default: false,
description: 'Whether to calculate the total item count',
},
],
},
];
// Export combined properties for use in index.ts
exports.roleMappingProperties = [exports.roleMappingOperations, ...exports.roleMappingFields];