UNPKG

n8n-nodes-arubacentral

Version:

n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities

36 lines (30 loc) 1.25 kB
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; import { apiRequest } from '../../../../helpers/apiRequest'; import { logger } from '../../../../helpers/logger'; import { handleApiError } from '../../../../helpers/errorHandler'; /** * Delete Switch * * DELETE /monitoring/v1/switches/{serial} * * @param this The n8n execution context * @returns Formatted API response */ export async function deleteSwitch(this: IExecuteFunctions): Promise<INodeExecutionData[]> { try { // Get parameters const serial = this.getNodeParameter('serial', 0) as string; logger.debug('monitoring:switch:deleteSwitch', `Deleting switch with serial: ${serial}`); // Make API request const endpoint = `/monitoring/v1/switches/${encodeURIComponent(serial)}`; const responseData = await apiRequest.call(this, 'DELETE', endpoint); logger.debug('monitoring:switch:deleteSwitch', 'Successfully deleted switch'); // Return formatted response return [ { json: { success: true, message: `Switch with serial ${serial} was deleted successfully` } }, ]; } catch (error) { logger.error('monitoring:switch:deleteSwitch:error', { message: error.message }); return handleApiError.call(this, error, 'Failed to delete switch'); } }