public static async Task Run(
            [TimerTrigger("0 0 5 * * *")] TimerInfo myTimer
            , ILogger log
            , [Blob("opml-file/SeanKilleenBlogs.opml", FileAccess.Write)] Stream blobOutput)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            var accessToken = await KeyVaultManager.GetFeedlyAccessToken();

            var opmlXml = await FeedlyManager.GetOpmlContents(accessToken);

            var categories = new List <string> {
                "development", "tech", "development - discover.net", "devops", "agile"
            };
            var filteredDoc = OpmlFilterer.FilterToCategories(opmlXml, categories);

            log.LogInformation("After filtering: ");
            log.LogInformation(filteredDoc);

            var filterAndLabeledDoc = OpmlLabeler.LabelOpmlFile(filteredDoc);

            log.LogInformation("After labeling: ");
            log.LogInformation(filterAndLabeledDoc);

            log.LogInformation("Saving to the blob");
            var thing = Encoding.Default.GetBytes(filterAndLabeledDoc);
            await blobOutput.WriteAsync(thing, 0, thing.Length);

            log.LogInformation("Finished!");
        }
Esempio n. 2
0
        // ReSharper disable once UnusedParameter.Global
        public static async Task Run([TimerTrigger("0 0 */6 * * *")] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"RefreshFeedlyAuthToken function executed at: {DateTime.Now}");
            log.LogInformation($"UserId: {userId}");

            log.LogInformation("Getting current access token contents from key vault");
            var accessToken = await KeyVaultManager.GetFeedlyAccessToken();

            log.LogInformation("Getting refreshed access token from Feedly API");
            var feedlyResponse = await FeedlyManager.RefreshFeedlyAccessToken(accessToken, log, refreshToken);

            log.LogInformation("Setting the secret in the key vault");
            await KeyVaultManager.UpdateFeedlyAccessToken(feedlyResponse.access_token);

            log.LogInformation("Successfully updated token in the key vault");
        }