UNPKG

n8n-nodes-proxmox

Version:

n8n community node for Proxmox Virtual Environment (VE) API integration with VM, container, storage, and cluster management capabilities

493 lines (492 loc) 15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.containerFields = exports.containerOperations = void 0; const baseProperties_1 = require("./baseProperties"); exports.containerOperations = { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, displayOptions: { show: { resource: ['container'], }, }, options: [ { name: 'Create', value: 'create', description: 'Create a new LXC container', action: 'Create a container', }, { name: 'Delete', value: 'delete', description: 'Delete an LXC container', action: 'Delete a container', }, { name: 'Get', value: 'get', description: 'Get container details', action: 'Get a container', }, { name: 'Get All', value: 'getAll', description: 'Get all containers', action: 'Get all containers', }, { name: 'Start', value: 'start', description: 'Start a container', action: 'Start a container', }, { name: 'Stop', value: 'stop', description: 'Stop a container', action: 'Stop a container', }, { name: 'Shutdown', value: 'shutdown', description: 'Gracefully shutdown a container', action: 'Shutdown a container', }, { name: 'Reboot', value: 'reboot', description: 'Reboot a container', action: 'Reboot a container', }, { name: 'Suspend', value: 'suspend', description: 'Suspend a container', action: 'Suspend a container', }, { name: 'Resume', value: 'resume', description: 'Resume a suspended container', action: 'Resume a container', }, { name: 'Clone', value: 'clone', description: 'Clone a container', action: 'Clone a container', }, { name: 'Migrate', value: 'migrate', description: 'Migrate a container to another node', action: 'Migrate a container', }, { name: 'Create Snapshot', value: 'snapshot', description: 'Create a snapshot of the container', action: 'Create container snapshot', }, { name: 'Get Status', value: 'getStatus', description: 'Get current status of a container', action: 'Get container status', }, ], default: 'getAll', }; exports.containerFields = [ // Common fields { displayName: baseProperties_1.nodeNameOption.displayName, name: baseProperties_1.nodeNameOption.name, type: baseProperties_1.nodeNameOption.type, required: baseProperties_1.nodeNameOption.required, default: baseProperties_1.nodeNameOption.default, placeholder: baseProperties_1.nodeNameOption.placeholder, description: baseProperties_1.nodeNameOption.description, displayOptions: { show: { resource: ['container'], operation: [ 'create', 'delete', 'get', 'start', 'stop', 'shutdown', 'reboot', 'suspend', 'resume', 'clone', 'migrate', 'snapshot', 'getStatus', ], }, }, }, { displayName: 'Container ID', name: baseProperties_1.vmIdOption.name, type: baseProperties_1.vmIdOption.type, required: baseProperties_1.vmIdOption.required, default: baseProperties_1.vmIdOption.default, typeOptions: baseProperties_1.vmIdOption.typeOptions, description: 'Unique ID of the container', displayOptions: { show: { resource: ['container'], operation: [ 'delete', 'get', 'start', 'stop', 'shutdown', 'reboot', 'suspend', 'resume', 'clone', 'migrate', 'snapshot', 'getStatus', ], }, }, }, // Create container specific fields { displayName: 'Container ID', name: 'newVmId', type: 'number', required: true, default: 100, typeOptions: { minValue: 100, maxValue: 999999999, }, description: 'Unique ID for the new container', displayOptions: { show: { resource: ['container'], operation: ['create'], }, }, }, { displayName: 'Container Template', name: 'ostemplate', type: 'string', required: true, default: '', placeholder: 'ubuntu-22.04-standard_22.04-1_amd64.tar.zst', description: 'Container template to use', displayOptions: { show: { resource: ['container'], operation: ['create'], }, }, }, // Clone specific fields { displayName: 'New Container ID', name: 'newVmId', type: 'number', required: true, default: 101, typeOptions: { minValue: 100, maxValue: 999999999, }, description: 'ID for the cloned container', displayOptions: { show: { resource: ['container'], operation: ['clone'], }, }, }, { displayName: 'Clone Name', name: 'cloneName', type: 'string', default: '', placeholder: 'cloned-container', description: 'Name for the cloned container', displayOptions: { show: { resource: ['container'], operation: ['clone'], }, }, }, // Migration fields { displayName: 'Target Node', name: 'targetNode', type: 'string', required: true, default: '', placeholder: 'pve-node-02', description: 'Target node for migration', displayOptions: { show: { resource: ['container'], operation: ['migrate'], }, }, }, // Snapshot fields { displayName: 'Snapshot Name', name: 'snapshotName', type: 'string', required: true, default: '', placeholder: 'snapshot-1', description: 'Name for the snapshot', displayOptions: { show: { resource: ['container'], operation: ['snapshot'], }, }, }, // Wait for task options { displayName: baseProperties_1.waitForTaskOption.displayName, name: baseProperties_1.waitForTaskOption.name, type: baseProperties_1.waitForTaskOption.type, default: baseProperties_1.waitForTaskOption.default, description: baseProperties_1.waitForTaskOption.description, displayOptions: { show: { resource: ['container'], operation: [ 'create', 'delete', 'start', 'stop', 'shutdown', 'reboot', 'suspend', 'resume', 'clone', 'migrate', 'snapshot', ], }, }, }, { displayName: baseProperties_1.taskTimeoutOption.displayName, name: baseProperties_1.taskTimeoutOption.name, type: baseProperties_1.taskTimeoutOption.type, default: baseProperties_1.taskTimeoutOption.default, typeOptions: baseProperties_1.taskTimeoutOption.typeOptions, description: baseProperties_1.taskTimeoutOption.description, displayOptions: { show: { resource: ['container'], operation: [ 'create', 'delete', 'start', 'stop', 'shutdown', 'reboot', 'suspend', 'resume', 'clone', 'migrate', 'snapshot', ], waitForTask: [true], }, }, }, // Get All options { displayName: baseProperties_1.returnAllOption.displayName, name: baseProperties_1.returnAllOption.name, type: baseProperties_1.returnAllOption.type, default: baseProperties_1.returnAllOption.default, description: baseProperties_1.returnAllOption.description, displayOptions: { show: { resource: ['container'], operation: ['getAll'], }, }, }, { displayName: baseProperties_1.limitOption.displayName, name: baseProperties_1.limitOption.name, type: baseProperties_1.limitOption.type, typeOptions: baseProperties_1.limitOption.typeOptions, default: baseProperties_1.limitOption.default, description: baseProperties_1.limitOption.description, displayOptions: { show: { resource: ['container'], operation: ['getAll'], returnAll: [false], }, }, }, // Additional options for create and clone { displayName: 'Additional Options', name: 'additionalOptions', type: 'collection', placeholder: 'Add Option', default: {}, displayOptions: { show: { resource: ['container'], operation: ['create', 'clone'], }, }, options: [ { displayName: 'Container Name', name: 'hostname', type: 'string', default: '', placeholder: 'my-container', description: 'Hostname for the container', }, { displayName: 'Memory (MB)', name: 'memory', type: 'number', default: 512, typeOptions: { minValue: 16, }, description: 'Amount of RAM for the container in MB', }, { displayName: 'Swap (MB)', name: 'swap', type: 'number', default: 512, typeOptions: { minValue: 0, }, description: 'Amount of swap space in MB', }, { displayName: 'CPU Cores', name: 'cores', type: 'number', default: 1, typeOptions: { minValue: 1, maxValue: 128, }, description: 'Number of CPU cores', }, { displayName: 'Disk Size (GB)', name: 'rootfs', type: 'string', default: '8', description: 'Size of the root filesystem in GB', }, { displayName: 'Storage', name: 'storage', type: 'string', default: 'local-lvm', description: 'Storage location for the container', }, { displayName: 'Network Configuration', name: 'net0', type: 'string', default: 'name=eth0,bridge=vmbr0,firewall=1,ip=dhcp', description: 'Network configuration for the container', }, { displayName: 'Password', name: 'password', type: 'string', typeOptions: { password: true }, default: '', description: 'Root password for the container', }, { displayName: 'SSH Public Key', name: 'ssh_public_keys', type: 'string', default: '', description: 'SSH public key to add to the container', }, { displayName: 'Unprivileged', name: 'unprivileged', type: 'boolean', default: true, description: 'Create an unprivileged container', }, { displayName: 'Start After Create', name: 'startAfterCreate', type: 'boolean', default: false, description: 'Whether to start the container after creation', }, ], }, // Additional options for various operations { displayName: 'Additional Options', name: 'additionalOptions', type: 'collection', placeholder: 'Add Option', default: {}, displayOptions: { show: { resource: ['container'], operation: ['stop', 'shutdown', 'migrate', 'snapshot'], }, }, options: [ { displayName: 'Force', name: 'force', type: 'boolean', default: false, description: 'Force the operation (use with caution)', }, { displayName: 'Skip Lock', name: 'skipLock', type: 'boolean', default: false, description: 'Skip container lock check', }, { displayName: 'Online Migration', name: 'online', type: 'boolean', default: true, description: 'Use online migration (only for migrate operation)', }, { displayName: 'Restart Services', name: 'restart', type: 'boolean', default: false, description: 'Restart services after migration', }, ], }, ];