|
| 1 | +using System; |
| 2 | +using System.IO; |
| 3 | +using System.Threading.Tasks; |
| 4 | +using Microsoft.AspNetCore.Mvc; |
| 5 | +using Microsoft.Azure.WebJobs; |
| 6 | +using Microsoft.Azure.WebJobs.Extensions.Http; |
| 7 | +using Microsoft.AspNetCore.Http; |
| 8 | +using Microsoft.Extensions.Logging; |
| 9 | +using Newtonsoft.Json; |
| 10 | + |
| 11 | +namespace AzureFunctionsDemo |
| 12 | +{ |
| 13 | + public static class GitMonitorApp |
| 14 | + { |
| 15 | + [FunctionName("GitMonitorApp")] |
| 16 | + public static async Task<IActionResult> Run( |
| 17 | + [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, |
| 18 | + ILogger log) |
| 19 | + { |
| 20 | + log.LogInformation("Git Monitor App"); |
| 21 | + |
| 22 | + string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); |
| 23 | + dynamic data = JsonConvert.DeserializeObject<Rootobject>(requestBody); |
| 24 | + |
| 25 | + log.LogInformation(requestBody); |
| 26 | + |
| 27 | + return new OkResult(); |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + public class Rootobject |
| 32 | + { |
| 33 | + public Authorization authorization { get; set; } |
| 34 | + public string caller { get; set; } |
| 35 | + public string channels { get; set; } |
| 36 | + public Claims claims { get; set; } |
| 37 | + public string correlationId { get; set; } |
| 38 | + public string description { get; set; } |
| 39 | + public string eventDataId { get; set; } |
| 40 | + public Eventname eventName { get; set; } |
| 41 | + public Category category { get; set; } |
| 42 | + public DateTime eventTimestamp { get; set; } |
| 43 | + public string id { get; set; } |
| 44 | + public string level { get; set; } |
| 45 | + public string operationId { get; set; } |
| 46 | + public Operationname operationName { get; set; } |
| 47 | + public string resourceGroupName { get; set; } |
| 48 | + public Resourceprovidername resourceProviderName { get; set; } |
| 49 | + public Resourcetype resourceType { get; set; } |
| 50 | + public string resourceId { get; set; } |
| 51 | + public Status status { get; set; } |
| 52 | + public Substatus subStatus { get; set; } |
| 53 | + public DateTime submissionTimestamp { get; set; } |
| 54 | + public string subscriptionId { get; set; } |
| 55 | + public string tenantId { get; set; } |
| 56 | + public Properties properties { get; set; } |
| 57 | + public object[] relatedEvents { get; set; } |
| 58 | + } |
| 59 | + |
| 60 | + public class Authorization |
| 61 | + { |
| 62 | + public string action { get; set; } |
| 63 | + public string scope { get; set; } |
| 64 | + } |
| 65 | + |
| 66 | + public class Claims |
| 67 | + { |
| 68 | + public string aud { get; set; } |
| 69 | + public string iss { get; set; } |
| 70 | + public string iat { get; set; } |
| 71 | + public string nbf { get; set; } |
| 72 | + public string exp { get; set; } |
| 73 | + public string httpschemasmicrosoftcomclaimsauthnclassreference { get; set; } |
| 74 | + public string aio { get; set; } |
| 75 | + public string altsecid { get; set; } |
| 76 | + public string httpschemasmicrosoftcomclaimsauthnmethodsreferences { get; set; } |
| 77 | + public string appid { get; set; } |
| 78 | + public string appidacr { get; set; } |
| 79 | + public string httpschemasxmlsoaporgws200505identityclaimsemailaddress { get; set; } |
| 80 | + public string httpschemasxmlsoaporgws200505identityclaimssurname { get; set; } |
| 81 | + public string httpschemasxmlsoaporgws200505identityclaimsgivenname { get; set; } |
| 82 | + public string groups { get; set; } |
| 83 | + public string httpschemasmicrosoftcomidentityclaimsidentityprovider { get; set; } |
| 84 | + public string ipaddr { get; set; } |
| 85 | + public string name { get; set; } |
| 86 | + public string httpschemasmicrosoftcomidentityclaimsobjectidentifier { get; set; } |
| 87 | + public string puid { get; set; } |
| 88 | + public string rh { get; set; } |
| 89 | + public string httpschemasmicrosoftcomidentityclaimsscope { get; set; } |
| 90 | + public string httpschemasxmlsoaporgws200505identityclaimsnameidentifier { get; set; } |
| 91 | + public string httpschemasmicrosoftcomidentityclaimstenantid { get; set; } |
| 92 | + public string httpschemasxmlsoaporgws200505identityclaimsname { get; set; } |
| 93 | + public string uti { get; set; } |
| 94 | + public string ver { get; set; } |
| 95 | + public string wids { get; set; } |
| 96 | + public string xms_tcdt { get; set; } |
| 97 | + } |
| 98 | + |
| 99 | + public class Eventname |
| 100 | + { |
| 101 | + public string value { get; set; } |
| 102 | + public string localizedValue { get; set; } |
| 103 | + } |
| 104 | + |
| 105 | + public class Category |
| 106 | + { |
| 107 | + public string value { get; set; } |
| 108 | + public string localizedValue { get; set; } |
| 109 | + } |
| 110 | + |
| 111 | + public class Operationname |
| 112 | + { |
| 113 | + public string value { get; set; } |
| 114 | + public string localizedValue { get; set; } |
| 115 | + } |
| 116 | + |
| 117 | + public class Resourceprovidername |
| 118 | + { |
| 119 | + public string value { get; set; } |
| 120 | + public string localizedValue { get; set; } |
| 121 | + } |
| 122 | + |
| 123 | + public class Resourcetype |
| 124 | + { |
| 125 | + public string value { get; set; } |
| 126 | + public string localizedValue { get; set; } |
| 127 | + } |
| 128 | + |
| 129 | + public class Status |
| 130 | + { |
| 131 | + public string value { get; set; } |
| 132 | + public string localizedValue { get; set; } |
| 133 | + } |
| 134 | + |
| 135 | + public class Substatus |
| 136 | + { |
| 137 | + public string value { get; set; } |
| 138 | + public string localizedValue { get; set; } |
| 139 | + } |
| 140 | + |
| 141 | + public class Properties |
| 142 | + { |
| 143 | + public string statusCode { get; set; } |
| 144 | + public object serviceRequestId { get; set; } |
| 145 | + public string eventCategory { get; set; } |
| 146 | + public string entity { get; set; } |
| 147 | + public string message { get; set; } |
| 148 | + public string hierarchy { get; set; } |
| 149 | + } |
| 150 | + |
| 151 | +} |
0 commit comments