private static async Task GetLatest(bool rebuildTable) { if (rebuildTable) { List <Service> onlineServiceList = await HtmlHelper.ParseAwsServices("https://aws.amazon.com/products/"); List <Service> master = ServiceListHelper.OrderServiceListByShortName(onlineServiceList); await DynamoHelper.RebuildTable(master); List <Service> serviceList = await DynamoHelper.QueryTable(); List <Tags> tagList = await HtmlHelper.ParseBlogTags("https://msimpson.co.nz/tags/aws/"); List <TableEntry> tableList = MarkdownHelper.BuildTable(serviceList, tagList); MarkdownHelper.BuildMarkdown(tableList); } else { List <Service> serviceList = await DynamoHelper.QueryTable(); List <Tags> tagList = await HtmlHelper.ParseBlogTags("https://msimpson.co.nz/tags/aws/"); List <TableEntry> tableList = MarkdownHelper.BuildTable(serviceList, tagList); MarkdownHelper.BuildMarkdown(tableList); } }
private async Task ProcessMessageAsync(SNSEvent.SNSRecord message, ILambdaContext context) { context.Logger.LogLine($"Processed message {message.Sns.Message}"); await DynamoHelper.UpdateTable(message.Sns.Message); context.Logger.LogLine($"Processed DynamoDB update"); }
public async Task IntegrationTest() { List <Service> onlineServiceList = await HtmlHelper.ParseAwsServices("https://aws.amazon.com/products/"); System.Console.WriteLine($"Query online list: {onlineServiceList.Count()}"); List <Service> masterServiceList = await DynamoHelper.QueryTable(); List <Service> orderedOnlineServiceList = ServiceListHelper.OrderServiceListById(onlineServiceList); List <Service> orderedMasterServiceList = ServiceListHelper.OrderServiceListById(masterServiceList); List <string> masterListId = orderedMasterServiceList.Select(x => x.id).ToList(); List <string> onlineListId = orderedOnlineServiceList.Select(x => x.id).ToList(); List <string> updateList = onlineListId.Except(masterListId).ToList(); List <string> removeList = masterListId.Except(onlineListId).ToList(); System.Console.WriteLine(); }
public async Task <string> FunctionHandler(ScheduledEvent cloudWatchEvent, ILambdaContext context) { System.Console.WriteLine($"EventId: {cloudWatchEvent.Id}"); List <Service> onlineServiceList = await HtmlHelper.ParseAwsServices("https://aws.amazon.com/products/"); System.Console.WriteLine($"Query online list: {onlineServiceList.Count()}"); List <Service> masterServiceList = await DynamoHelper.QueryTable(); System.Console.WriteLine($"Query online list: {masterServiceList.Count()}"); var sendNotifcation = await MessageHelper.SendNotification(onlineServiceList, masterServiceList, sqlQueueUrl); System.Console.WriteLine($"Compare Result: {sendNotifcation}"); return(sendNotifcation); }
public async Task GenerateAdminAuditRecord(MyRentAccountAdminAudit generateAuditRequest) { LambdaLogger.Log(string.Format("Saving to DB - {0}", JsonConvert.SerializeObject(generateAuditRequest))); var documentItem = DynamoHelper.ConstructAdminAuditDynamoDocument(generateAuditRequest); try { await _documentsTable.PutItemAsync(documentItem).ConfigureAwait(true); } catch (AmazonServiceException ase) { LambdaLogger.Log("Could not complete operation"); LambdaLogger.Log("Error Message: " + ase.Message); LambdaLogger.Log("HTTP Status: " + ase.StatusCode); LambdaLogger.Log("AWS Error Code: " + ase.ErrorCode); LambdaLogger.Log("Error Type: " + ase.ErrorType); LambdaLogger.Log("Request ID: " + ase.RequestId); } catch (AmazonClientException ace) { LambdaLogger.Log("Internal error occurred communicating with DynamoDB"); LambdaLogger.Log("Error Message: " + ace.Message); } }
public async Task TestUpdateDynamo() { var rawUpdate = File.ReadAllText("TestData/update-test.json"); await DynamoHelper.UpdateTable(rawUpdate); }