-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProcessBundles.cs
38 lines (35 loc) · 1.57 KB
/
ProcessBundles.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Net;
using AzurecomStatsFunctions.Shared;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace AzurecomStatsFunctions
{
public static class ProcessBundles
{
[FunctionName("process-bundles")]
[return: Table("bundles")]
public static BundleData Run(
[TimerTrigger("0 0 0 */1 * *")]TimerInfo myTimer,
ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
var homeHtmlUrl = "https://azure.microsoft.com/en-us/";
var homeCssUrl = "https://azure.microsoft.com/dest/bundles/home.css";
var homeJsUrl = "https://azure.microsoft.com/dest/bundles/home.js";
var coreCssUrl = "https://azure.microsoft.com/dest/bundles/core.css";
var coreJsUrl = "https://azure.microsoft.com/dest/bundles/core.js";
return new BundleData
{
PartitionKey = "Bundle",
RowKey = Guid.NewGuid().ToString(),
HomepageHtmlPayloadSize = WebRequest.Create(homeHtmlUrl).GetResponse().ContentLength,
HomepageCssBundleSize = WebRequest.Create(homeCssUrl).GetResponse().ContentLength,
HomepageJsBundleSize = WebRequest.Create(homeJsUrl).GetResponse().ContentLength,
CoreCssBundleSize = WebRequest.Create(coreCssUrl).GetResponse().ContentLength,
CoreJsBundleSize = WebRequest.Create(coreJsUrl).GetResponse().ContentLength,
};
}
}
}