n8n-nodes-librenms
Version:
n8n community node for LibreNMS network monitoring system integration with comprehensive device management and monitoring capabilities
313 lines (312 loc) • 9.69 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.portsFields = exports.portsOperations = void 0;
exports.portsOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['ports'],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Get all ports',
action: 'Get all ports',
routing: {
request: {
method: 'GET',
url: '/ports',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'ports',
},
},
],
},
},
},
{
name: 'Get',
value: 'get',
description: 'Get port information',
action: 'Get a port',
routing: {
request: {
method: 'GET',
url: '=/ports/{{$parameter.portId}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'port',
},
},
],
},
},
},
{
name: 'Search',
value: 'search',
description: 'Search ports',
action: 'Search ports',
routing: {
request: {
method: 'GET',
url: '=/ports/search/{{$parameter.searchTerm}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'ports',
},
},
],
},
},
},
{
name: 'Search by Field',
value: 'searchByField',
description: 'Search ports in specific fields',
action: 'Search ports by field',
routing: {
request: {
method: 'GET',
url: '=/ports/search/{{$parameter.searchField}}/{{$parameter.searchTerm}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'ports',
},
},
],
},
},
},
{
name: 'Get by MAC Address',
value: 'getByMac',
description: 'Search ports by MAC address',
action: 'Get ports by MAC address',
routing: {
request: {
method: 'GET',
url: '=/ports/mac/{{$parameter.macAddress}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'port',
},
},
],
},
},
},
{
name: 'Get IP Addresses',
value: 'getIpAddresses',
description: 'Get IP addresses for a port',
action: 'Get port IP addresses',
routing: {
request: {
method: 'GET',
url: '=/ports/{{$parameter.portId}}/ip',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'addresses',
},
},
],
},
},
},
{
name: 'Update Description',
value: 'updateDescription',
description: 'Update port description',
action: 'Update port description',
routing: {
request: {
method: 'PATCH',
url: '=/ports/{{$parameter.portId}}/description',
},
send: {
type: 'body',
},
},
},
],
default: 'getAll',
},
];
exports.portsFields = [
// Port ID for specific operations
{
displayName: 'Port ID',
name: 'portId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['ports'],
operation: ['get', 'getIpAddresses', 'updateDescription'],
},
},
default: '',
description: 'The port ID',
},
// Search term for search operations
{
displayName: 'Search Term',
name: 'searchTerm',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['ports'],
operation: ['search', 'searchByField'],
},
},
default: '',
description: 'Term to search for',
},
// Search field for field-specific searches
{
displayName: 'Search Field',
name: 'searchField',
type: 'options',
required: true,
displayOptions: {
show: {
resource: ['ports'],
operation: ['searchByField'],
},
},
options: [
{ name: 'Interface Name', value: 'ifName' },
{ name: 'Interface Description', value: 'ifDescr' },
{ name: 'Interface Alias', value: 'ifAlias' },
],
default: 'ifName',
description: 'Field to search in',
},
// MAC address for MAC search
{
displayName: 'MAC Address',
name: 'macAddress',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['ports'],
operation: ['getByMac'],
},
},
default: '',
placeholder: '00:11:22:33:44:55',
description: 'MAC address to search for',
},
// Description for update
{
displayName: 'Description',
name: 'description',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['ports'],
operation: ['updateDescription'],
},
},
default: '',
description: 'New port description',
},
// Options for getAll
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['ports'],
operation: ['getAll', 'search', 'searchByField'],
},
},
options: [
{
displayName: 'Columns',
name: 'columns',
type: 'string',
default: '',
placeholder: 'ifName,port_id,ifAlias',
description: 'Comma-separated list of columns to return',
routing: {
send: {
type: 'query',
property: 'columns',
},
},
},
],
},
// Filter for MAC search
{
displayName: 'MAC Search Options',
name: 'macOptions',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['ports'],
operation: ['getByMac'],
},
},
options: [
{
displayName: 'Filter',
name: 'filter',
type: 'options',
options: [
{ name: 'All Results', value: '' },
{ name: 'First Result Only', value: 'first' },
],
default: '',
description: 'Filter results',
routing: {
send: {
type: 'query',
property: 'filter',
},
},
},
],
},
];