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); } }
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); }