public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "graph/refresh")] HttpRequest?request, [DurableClient] IDurableOrchestrationClient starter) { try { var orchestratorRequestModel = new OrchestratorRequestModel { IsDraftEnvironment = environmentValues.IsDraftEnvironment, SuccessRelayPercent = environmentValues.SuccessRelayPercent, }; if (!orchestratorRequestModel.IsDraftEnvironment) { return(new BadRequestResult()); } logger.LogInformation("Received graph refresh request"); string instanceId = await starter.StartNewAsync(nameof(LmiImportOrchestrationTrigger.GraphRefreshOrchestrator), orchestratorRequestModel).ConfigureAwait(false); logger.LogInformation($"Started orchestration with ID = '{instanceId}'."); return(starter.CreateCheckStatusResponse(request, instanceId)); } catch (Exception ex) { logger.LogError(ex.ToString()); return(new StatusCodeResult((int)HttpStatusCode.InternalServerError)); } }
public async Task Run( [TimerTrigger("%LmiImportTimerTriggerSchedule%")] TimerInfo myTimer, [DurableClient] IDurableOrchestrationClient starter) { var orchestratorRequestModel = new OrchestratorRequestModel { IsDraftEnvironment = environmentValues.IsDraftEnvironment, SuccessRelayPercent = environmentValues.SuccessRelayPercent, }; if (orchestratorRequestModel.IsDraftEnvironment) { string instanceId = await starter.StartNewAsync(nameof(LmiImportOrchestrationTrigger.GraphRefreshOrchestrator), orchestratorRequestModel).ConfigureAwait(false); logger.LogInformation($"Started orchestration with ID = '{instanceId}'."); } logger.LogTrace($"Next run of {nameof(LmiImportTimerTrigger)}is {myTimer?.ScheduleStatus?.Next}"); }