UNPKG

n8n-nodes-arubacentral

Version:

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

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