-
Notifications
You must be signed in to change notification settings - Fork 4
/
Function.cs
40 lines (36 loc) · 1.48 KB
/
Function.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
39
40
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
namespace Indigo.Functions.Autofac.IntegrationTests.Target
{
public static class Function
{
[FunctionName("ConfigurationFunction")]
public static IActionResult ConfigurationFunction(
[HttpTrigger(AuthorizationLevel.Function, "GET", Route = "config/{key}")] HttpRequest req,
string key,
[Inject] ValueProvider provider)
{
return new OkObjectResult(provider.GetSettingValue(key));
}
[FunctionName("DependencyFunction")]
public static IActionResult DependencyFunction(
[HttpTrigger(AuthorizationLevel.Function, "GET", Route = "Dependency")] HttpRequest req,
[Inject] IDependency dependency,
ILogger log)
{
return new OkObjectResult($"Instance of dependency {dependency.GetType()}");
}
[FunctionName("LoggingDependencyFunction")]
public static IActionResult LoggingDependencyFunction(
[HttpTrigger(AuthorizationLevel.Function, "GET", Route = "LoggingDependency")] HttpRequest req,
[Inject] ILoggingDependency dependency,
ILogger log)
{
dependency.Log($"Logging message to injected logger");
return new OkObjectResult($"Instance of dependency {dependency.GetType()}");
}
}
}