UNPKG

n8n-nodes-netbox

Version:

n8n community node for NetBox API integration with comprehensive DCIM, IPAM, and data center management operations

291 lines (290 loc) 7.74 kB
"use strict"; // descriptions/tenancy.descriptions.ts Object.defineProperty(exports, "__esModule", { value: true }); exports.tenancyProperties = exports.tenantGroupFields = exports.tenantGroupOperations = exports.tenantFields = exports.tenantOperations = exports.tenancyResources = void 0; // Resource options for tenancy domain exports.tenancyResources = [ { name: 'Tenants', value: 'tenants', description: 'Manage tenants', }, { name: 'Tenant Groups', value: 'tenantGroups', description: 'Manage tenant groups', }, { name: 'Contacts', value: 'contacts', description: 'Manage contacts', }, { name: 'Contact Roles', value: 'contactRoles', description: 'Manage contact roles', }, { name: 'Contact Groups', value: 'contactGroups', description: 'Manage contact groups', }, { name: 'Contact Assignments', value: 'contactAssignments', description: 'Manage contact assignments', }, ]; // Common fields for many resources const commonListOperationFields = [ { displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, description: 'Whether to return all results or only up to a limit', displayOptions: { show: { operation: ['list'], }, }, }, { displayName: 'Limit', name: 'limit', type: 'number', default: 50, description: 'Max number of results to return', typeOptions: { minValue: 1, }, displayOptions: { show: { operation: ['list'], returnAll: [false], }, }, }, ]; const commonIDField = { displayName: 'ID', name: 'id', type: 'string', required: true, default: '', description: 'ID of the record', displayOptions: { show: { operation: ['get', 'update', 'delete'], }, }, }; // Tenant Operations and Fields exports.tenantOperations = { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, default: 'list', required: true, options: [ { name: 'List', value: 'list', action: 'List tenants', description: 'Get all tenants', }, { name: 'Get', value: 'get', action: 'Get a tenant', description: 'Get tenant by ID', }, { name: 'Create', value: 'create', action: 'Create a tenant', description: 'Create a new tenant', }, { name: 'Update', value: 'update', action: 'Update a tenant', description: 'Update an existing tenant', }, { name: 'Delete', value: 'delete', action: 'Delete a tenant', description: 'Delete a tenant', }, ], displayOptions: { show: { domain: ['tenancy'], resource: ['tenants'], }, }, }; exports.tenantFields = [ commonIDField, ...commonListOperationFields, { displayName: 'Name', name: 'name', type: 'string', default: '', required: true, description: 'Name of the tenant', displayOptions: { show: { domain: ['tenancy'], resource: ['tenants'], operation: ['create', 'update'], }, }, }, { displayName: 'Slug', name: 'slug', type: 'string', default: '', required: true, description: 'Slug of the tenant', displayOptions: { show: { domain: ['tenancy'], resource: ['tenants'], operation: ['create', 'update'], }, }, }, { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', default: {}, displayOptions: { show: { domain: ['tenancy'], resource: ['tenants'], operation: ['create', 'update'], }, }, options: [ { displayName: 'Description', name: 'description', type: 'string', default: '', description: 'Description of the tenant', }, { displayName: 'Group ID', name: 'group', type: 'number', default: null, description: 'ID of the parent tenant group', }, { displayName: 'Tags', name: 'tags', type: 'string', default: '', description: 'Tags to apply to this tenant (comma-separated)', }, ], }, { displayName: 'Filters', name: 'filters', type: 'collection', placeholder: 'Add Filter', default: {}, displayOptions: { show: { domain: ['tenancy'], resource: ['tenants'], operation: ['list'], }, }, options: [ { displayName: 'Name', name: 'name', type: 'string', default: '', description: 'Filter by tenant name', }, { displayName: 'Group ID', name: 'group_id', type: 'number', default: null, description: 'Filter by tenant group ID', }, ], }, ]; // Define similar operations and fields for other resources in tenancy domain // Tenant Group Operations and Fields exports.tenantGroupOperations = { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, default: 'list', required: true, options: [ { name: 'List', value: 'list', action: 'List tenant groups', description: 'Get all tenant groups', }, { name: 'Get', value: 'get', action: 'Get a tenant group', description: 'Get tenant group by ID', }, { name: 'Create', value: 'create', action: 'Create a tenant group', description: 'Create a new tenant group', }, { name: 'Update', value: 'update', action: 'Update a tenant group', description: 'Update an existing tenant group', }, { name: 'Delete', value: 'delete', action: 'Delete a tenant group', description: 'Delete a tenant group', }, ], displayOptions: { show: { domain: ['tenancy'], resource: ['tenantGroups'], }, }, }; exports.tenantGroupFields = [ // Similar to tenant fields but adapted for tenant groups // ... ]; // Continue with operations and fields for contacts, contactRoles, contactGroups, contactAssignments // Export all properties together exports.tenancyProperties = [ exports.tenantOperations, ...exports.tenantFields, exports.tenantGroupOperations, ...exports.tenantGroupFields, // Include operations and fields for other tenancy resources ];