public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { string result = "Alert successfully confirmed."; // parse query parameter string IncidentId = ""; if (req.GetQueryParameterDictionary().ContainsKey("incidentid")) { IncidentId = req.GetQueryParameterDictionary()["incidentid"]; log.LogInformation($"Preparing to confirm SNOW incident {IncidentId}"); AlertIncidentEntity alertIncident = alertUtils.GetAlertIncident("SNOW", IncidentId); if (alertIncident != null) { AlertEntity alert = alertUtils.GetAlert(alertIncident.AlertPartitionId, alertIncident.AlertRowId); alertUtils.DeleteAlert(alert); alertUtils.DeleteAlertIncident(alertIncident); } } else { log.LogInformation("NO incidentid was passed, so checking all open incidents.."); alertUtils.CheckIncidentsStatus(log); } log.LogInformation("Finished checking incident status"); return((ActionResult) new OkObjectResult(result)); }
public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, ILogger log) { log.LogInformation($"AzureAlertConfirmTimerFunction Timer trigger function executed at: {DateTime.Now}"); alertUtils.CheckIncidentsStatus(log); log.LogInformation("Finished checking incident status"); }