public async Task FunctionHandler(S3NotificationEvent input, ILambdaContext context) { var data = input?.GetFileData(); var retriever = new S3ObjectRetriever(data.Value.objectsKey, RegionEndpoint.GetBySystemName(data.Value.region)); using var connection = new DbConnection(); await connection.GetConnection().OpenAsync().ConfigureAwait(false); var logSaver = new LogSaver(connection.GetConnection()); string logId = await logSaver.GetAssociatedLogIdAsync(data.Value.objectsKey).ConfigureAwait(false); if (!String.IsNullOrEmpty(logId)) { var entries = retriever.GetObjectDataAsync().Select( logLine => EntryParser.ProcessLogLine(logLine)); await logSaver.SaveLogsAsync(logId, entries).ConfigureAwait(false); if (NotificationSender.IsNotificationNecessary(data.Value.objectsKey)) { await NotificationSender.TryPublishNotification(data.Value.objectsKey).ConfigureAwait(false); } } else { throw new Exception($"Log with given object name " + $"({data.Value.objectsKey}) has no associated record in database"); } }