n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
34 lines (28 loc) • 1.06 kB
text/typescript
// api/inventory/devices/deleteDevice.methods.ts
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { apiRequest } from '../../../helpers/apiRequest';
import { formatResponse } from '../../../helpers/responseFormatter';
import { logger } from '../../../helpers/logger';
export async function deleteDevice(this: IExecuteFunctions): Promise<INodeExecutionData[]> {
logger.info('inventory:devices:deleteDevice', 'Starting deleteDevice operation');
try {
const serial = this.getNodeParameter('serial', 0) as string;
const requestBody = {
serial,
};
logger.debug('inventory:devices:deleteDevice', `Deleting device with serial: ${serial}`);
// Make API request
const response = await apiRequest.call(
this,
'DELETE',
'/platform/device_inventory/v1/devices',
requestBody,
{},
);
logger.info('inventory:devices:deleteDevice', 'Device deleted successfully');
return formatResponse(response);
} catch (error) {
logger.error('inventory:devices:deleteDevice:error', error.message);
throw error;
}
}