diff --git a/Templates.sln b/Templates.sln index 5647c812..c763acbe 100644 --- a/Templates.sln +++ b/Templates.sln @@ -58,6 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rocket.Surgery.Web", "templ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rocket.Surgery.Templates", "templates\Rocket.Surgery.Templates.csproj", "{59B51B1F-ED6D-4EFB-B1F6-479532638CFF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rocket.Surgery.Functions", "templates\Function\Rocket.Surgery.Functions.csproj", "{CB33D3D9-673C-4764-9B42-DBA3EBEA753A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -128,6 +130,18 @@ Global {59B51B1F-ED6D-4EFB-B1F6-479532638CFF}.Release|x64.Build.0 = Release|Any CPU {59B51B1F-ED6D-4EFB-B1F6-479532638CFF}.Release|x86.ActiveCfg = Release|Any CPU {59B51B1F-ED6D-4EFB-B1F6-479532638CFF}.Release|x86.Build.0 = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|x64.ActiveCfg = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|x64.Build.0 = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|x86.ActiveCfg = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Debug|x86.Build.0 = Debug|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|Any CPU.Build.0 = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|x64.ActiveCfg = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|x64.Build.0 = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|x86.ActiveCfg = Release|Any CPU + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -140,5 +154,6 @@ Global {4B5B6606-AC5C-4FAB-9081-F49E215876D9} = {38ABF504-0DA2-41BA-B262-3E23746CBC3C} {EBC8D6EE-EBF1-4AB3-9AD6-7B86F17276B5} = {38ABF504-0DA2-41BA-B262-3E23746CBC3C} {2B6FD22D-064C-4B0E-9EFD-97F65784AB32} = {38ABF504-0DA2-41BA-B262-3E23746CBC3C} + {CB33D3D9-673C-4764-9B42-DBA3EBEA753A} = {38ABF504-0DA2-41BA-B262-3E23746CBC3C} EndGlobalSection EndGlobal diff --git a/templates/Api/Rocket.Surgery.Api.csproj b/templates/Api/Rocket.Surgery.Api.csproj index 3e7d9e60..60c11913 100644 --- a/templates/Api/Rocket.Surgery.Api.csproj +++ b/templates/Api/Rocket.Surgery.Api.csproj @@ -8,7 +8,6 @@ - @@ -18,7 +17,6 @@ - diff --git a/templates/Cli/Rocket.Surgery.Cli.csproj b/templates/Cli/Rocket.Surgery.Cli.csproj index 5ef6aab8..547abded 100644 --- a/templates/Cli/Rocket.Surgery.Cli.csproj +++ b/templates/Cli/Rocket.Surgery.Cli.csproj @@ -8,7 +8,6 @@ - diff --git a/templates/Function/.template.confg/template.json b/templates/Function/.template.confg/template.json index 661cc3cd..656c544d 100644 --- a/templates/Function/.template.confg/template.json +++ b/templates/Function/.template.confg/template.json @@ -1,7 +1,7 @@ { "$schema": "http://json.schemastore.org/template", "author": "David Driscoll", - "classifications": [ "Common", "Functions", "Rocket Surgery" ], + "classifications": [ "Common", "Function", "Rocket Surgery" ], "identity": "Rocket.Surgery.Functions", "name": "Rocket Surgery Azure Functions Application", "shortName": "rocketfunction", diff --git a/templates/Function/Function.cs b/templates/Function/Function.cs new file mode 100644 index 00000000..069e7571 --- /dev/null +++ b/templates/Function/Function.cs @@ -0,0 +1,25 @@ +using System; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Host; +using Microsoft.Extensions.Logging; + +namespace Rocket.Surgery.Functions +{ + public class Function + { + private readonly ILogger _logger; + + public Function(ILogger logger) => _logger = logger; + + [FunctionName("Function")] + public ActionResult Run([HttpTrigger("get")]HttpRequest context, ILogger logger) + { + logger.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); + _logger.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); + + return 1; + } + } +} diff --git a/templates/Function/Rocket.Surgery.Functions.csproj b/templates/Function/Rocket.Surgery.Functions.csproj new file mode 100644 index 00000000..a9eb0275 --- /dev/null +++ b/templates/Function/Rocket.Surgery.Functions.csproj @@ -0,0 +1,35 @@ + + + netcoreapp2.1 + v2 + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + + diff --git a/templates/Function/Startup.cs b/templates/Function/Startup.cs new file mode 100644 index 00000000..2773a7d7 --- /dev/null +++ b/templates/Function/Startup.cs @@ -0,0 +1,29 @@ +using System; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Host; +using Microsoft.Azure.WebJobs.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Rocket.Surgery.Extensions.DependencyInjection; +using Rocket.Surgery.Hosting.Functions; + +[assembly: WebJobsStartup(typeof(Rocket.Surgery.Functions.Startup))] + +namespace Rocket.Surgery.Functions +{ + public class Startup : IWebJobsStartup, IServiceConvention + { + public void Register(IServiceConventionContext context) + { + } + + public void Configure(IWebJobsBuilder builder) + { + builder.UseRocketSurgery( + this, + hostBuilder => + { + }); + } + } +} diff --git a/templates/Function/host.json b/templates/Function/host.json new file mode 100644 index 00000000..b9f92c0d --- /dev/null +++ b/templates/Function/host.json @@ -0,0 +1,3 @@ +{ + "version": "2.0" +} \ No newline at end of file diff --git a/templates/Function/local.settings.json b/templates/Function/local.settings.json new file mode 100644 index 00000000..bf70960e --- /dev/null +++ b/templates/Function/local.settings.json @@ -0,0 +1,7 @@ +{ + "IsEncrypted": false, + "Values": { + "AzureWebJobsStorage": "", + "FUNCTIONS_WORKER_RUNTIME": "dotnet" + } +} \ No newline at end of file diff --git a/templates/GenericHost/Rocket.Surgery.GenericHost.csproj b/templates/GenericHost/Rocket.Surgery.GenericHost.csproj index 5ef6aab8..547abded 100644 --- a/templates/GenericHost/Rocket.Surgery.GenericHost.csproj +++ b/templates/GenericHost/Rocket.Surgery.GenericHost.csproj @@ -8,7 +8,6 @@ -