private async Task GenerateAlarms(WatchmanConfiguration config, RunMode mode) { await _dynamoGenerator.GenerateAlarmsFor(config, mode); await _orphanTablesReporter.FindAndReport(config); await _sqsGenerator.GenerateAlarmsFor(config, mode); await _orphanQueuesReporter.FindAndReport(config); var failed = new List <IList <string> >(); foreach (var service in _otherServices) { var result = await service.GenerateAlarmsForService(config, mode); failed.Add(result.FailingGroups); } var allFailed = failed.SelectMany(_ => _).Distinct().ToArray(); if (mode == RunMode.DryRun || mode == RunMode.GenerateAlarms) { await _creator.SaveChanges(mode == RunMode.DryRun); } if (allFailed.Any()) { throw new Exception("The following groups reported errors and were not deployed: " + $"{string.Join(", ", allFailed)}. please see logs."); } }
private async Task GenerateAlarms(WatchmanConfiguration config, RunMode mode) { await _dynamoGenerator.GenerateAlarmsFor(config, mode); await _orphanTablesReporter.FindAndReport(config); await _sqsGenerator.GenerateAlarmsFor(config, mode); await _orphanQueuesReporter.FindAndReport(config); foreach (var service in _otherServices) { await service.GenerateAlarmsForService(config, mode); } if (mode == RunMode.DryRun || mode == RunMode.GenerateAlarms) { await _creator.SaveChanges(mode == RunMode.DryRun); } }