n8n-nodes-arubacentral
Version:
n8n community node for Aruba Central API integration with comprehensive monitoring, configuration, and management capabilities
34 lines (33 loc) • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteSwitch = deleteSwitch;
const apiRequest_1 = require("../../../../helpers/apiRequest");
const logger_1 = require("../../../../helpers/logger");
const errorHandler_1 = require("../../../../helpers/errorHandler");
/**
* Delete Switch
*
* DELETE /monitoring/v1/switches/{serial}
*
* @param this The n8n execution context
* @returns Formatted API response
*/
async function deleteSwitch() {
try {
// Get parameters
const serial = this.getNodeParameter('serial', 0);
logger_1.logger.debug('monitoring:switch:deleteSwitch', `Deleting switch with serial: ${serial}`);
// Make API request
const endpoint = `/monitoring/v1/switches/${encodeURIComponent(serial)}`;
const responseData = await apiRequest_1.apiRequest.call(this, 'DELETE', endpoint);
logger_1.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_1.logger.error('monitoring:switch:deleteSwitch:error', { message: error.message });
return errorHandler_1.handleApiError.call(this, error, 'Failed to delete switch');
}
}