public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Admin, "post", Route = "restart")] HttpRequest req, [OrchestrationClient] DurableOrchestrationClient starter, ILogger log) { var connections = await _scheduleConnectorService.ListConnectionsAsync(); foreach (var connectionModel in connections) { var teamModel = TeamModel.FromConnection(connectionModel); await starter.TryStartSingletonAsync(nameof(TeamOrchestrator), teamModel.TeamId, teamModel); } return(new OkResult()); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Admin, "post", Route = "start/{teamId}")] HttpRequest req, [OrchestrationClient] DurableOrchestrationClient starter, string teamId, ILogger log) { var connectionModel = await _scheduleConnectorService.GetConnectionAsync(teamId); var teamModel = TeamModel.FromConnection(connectionModel); if (await starter.TryStartSingletonAsync(nameof(TeamOrchestrator), teamModel.TeamId, teamModel)) { return(new OkResult()); } else { return(new ConflictResult()); } }