MonitorCosmosDB.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Net.Http;
  4. using System.Threading.Tasks;
  5. using CoreSDK.DingDing;
  6. using Microsoft.Azure.Documents;
  7. using Microsoft.Azure.WebJobs;
  8. using Microsoft.Azure.WebJobs.Host;
  9. using Microsoft.Extensions.Logging;
  10. namespace TEAMModelFunction
  11. {
  12. public class MonitorCosmosDB
  13. {
  14. private readonly IHttpClientFactory _clientFactory;
  15. public MonitorCosmosDB(IHttpClientFactory clientFactory)
  16. {
  17. _clientFactory = clientFactory;
  18. }
  19. [FunctionName("School")]
  20. public async Task School([CosmosDBTrigger(
  21. databaseName: "TEAMModelOS",
  22. collectionName: "School",
  23. ConnectionStringSetting = "CosmosConnection",
  24. LeaseCollectionName = "leases")]IReadOnlyList<Document> input, ILogger log)
  25. {
  26. if (input != null && input.Count > 0)
  27. {
  28. log.LogInformation("Documents modified " + input.Count);
  29. log.LogInformation("First document Id " + input[0].Id);
  30. }
  31. }
  32. }
  33. }