diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index d51e23920..07404edf9 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -15,7 +15,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/appsettings.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/appsettings.json
index 09cf536c1..5ec73ff5b 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/appsettings.json
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI-FSharp/template/src/BlueprintBaseName.1/appsettings.json
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
- "Default": "Warning"
+ "Default": "Information"
}
}
}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 1273012bf..7b6581189 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,8 +6,8 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/appsettings.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/appsettings.json
index 2699e2957..6d0536ac4 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/appsettings.json
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/appsettings.json
@@ -1,8 +1,7 @@
{
- "Lambda.Logging": {
+ "Logging": {
"LogLevel": {
- "Default": "Debug",
- "Microsoft": "Information"
+ "Default": "Information"
}
},
"AppS3Bucket": ""
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/serverless.template b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/serverless.template
index c5f404021..bae6a35ab 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/serverless.template
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/src/BlueprintBaseName.1/serverless.template
@@ -1,78 +1,127 @@
{
- "AWSTemplateFormatVersion" : "2010-09-09",
- "Transform" : "AWS::Serverless-2016-10-31",
- "Description" : "An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
+ "AWSTemplateFormatVersion": "2010-09-09",
+ "Transform": "AWS::Serverless-2016-10-31",
+ "Description": "An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
- "Parameters" : {
- "ShouldCreateBucket" : {
- "Type" : "String",
- "AllowedValues" : ["true", "false"],
- "Description" : "If true then the S3 bucket that will be proxied will be created with the CloudFormation stack."
- },
- "BucketName" : {
- "Type" : "String",
- "Description" : "Name of S3 bucket that will be proxied. If left blank a name will be generated.",
- "MinLength" : "0"
- }
- },
+ "Parameters": {
+ "ShouldCreateBucket": {
+ "Type": "String",
+ "AllowedValues": [
+ "true",
+ "false"
+ ],
+ "Description": "If true then the S3 bucket that will be proxied will be created with the CloudFormation stack."
+ },
+ "BucketName": {
+ "Type": "String",
+ "Description": "Name of S3 bucket that will be proxied. If left blank a name will be generated.",
+ "MinLength": "0"
+ }
+ },
+ "Conditions": {
+ "CreateS3Bucket": {
+ "Fn::Equals": [
+ {
+ "Ref": "ShouldCreateBucket"
+ },
+ "true"
+ ]
+ },
+ "BucketNameGenerated": {
+ "Fn::Equals": [
+ {
+ "Ref": "BucketName"
+ },
+ ""
+ ]
+ }
+ },
- "Conditions" : {
- "CreateS3Bucket" : {"Fn::Equals" : [{"Ref" : "ShouldCreateBucket"}, "true"]},
- "BucketNameGenerated" : {"Fn::Equals" : [{"Ref" : "BucketName"}, ""]}
- },
+ "Resources": {
+ "AspNetCoreFunction": {
+ "Type": "AWS::Serverless::Function",
+ "Properties": {
+ "Handler": "BlueprintBaseName.1::BlueprintBaseName._1.LambdaEntryPoint::FunctionHandlerAsync",
+ "Runtime": "dotnetcore2.1",
+ "CodeUri": "",
+ "MemorySize": 256,
+ "Timeout": 30,
+ "Role": null,
+ "Policies": [
+ "AWSLambdaFullAccess"
+ ],
+ "Environment": {
+ "Variables": {
+ "AppS3Bucket": {
+ "Fn::If": [
+ "CreateS3Bucket",
+ {
+ "Ref": "Bucket"
+ },
+ {
+ "Ref": "BucketName"
+ }
+ ]
+ }
+ }
+ },
+ "Events": {
+ "ProxyResource": {
+ "Type": "Api",
+ "Properties": {
+ "Path": "/{proxy+}",
+ "Method": "ANY"
+ }
+ },
+ "RootResource": {
+ "Type": "Api",
+ "Properties": {
+ "Path": "/",
+ "Method": "ANY"
+ }
+ }
+ }
+ }
+ },
- "Resources" : {
+ "Bucket": {
+ "Type": "AWS::S3::Bucket",
+ "Condition": "CreateS3Bucket",
+ "Properties": {
+ "BucketName": {
+ "Fn::If": [
+ "BucketNameGenerated",
+ {
+ "Ref": "AWS::NoValue"
+ },
+ {
+ "Ref": "BucketName"
+ }
+ ]
+ }
+ }
+ }
+ },
- "AspNetCoreFunction" : {
- "Type" : "AWS::Serverless::Function",
- "Properties": {
- "Handler": "BlueprintBaseName.1::BlueprintBaseName._1.LambdaEntryPoint::FunctionHandlerAsync",
- "Runtime": "dotnetcore2.1",
- "CodeUri": "",
- "MemorySize": 256,
- "Timeout": 30,
- "Role": null,
- "Policies": [ "AWSLambdaFullAccess" ],
- "Environment" : {
- "Variables" : {
- "AppS3Bucket" : { "Fn::If" : ["CreateS3Bucket", {"Ref":"Bucket"}, { "Ref" : "BucketName" } ] }
- }
- },
- "Events": {
- "ProxyResource": {
- "Type": "Api",
- "Properties": {
- "Path": "/{proxy+}",
- "Method": "ANY"
- }
- },
- "RootResource": {
- "Type": "Api",
- "Properties": {
- "Path": "/",
- "Method": "ANY"
- }
- }
- }
- }
- },
-
- "Bucket" : {
- "Type" : "AWS::S3::Bucket",
- "Condition" : "CreateS3Bucket",
- "Properties" : {
- "BucketName" : { "Fn::If" : ["BucketNameGenerated", {"Ref" : "AWS::NoValue" }, { "Ref" : "BucketName" } ] }
- }
- }
- },
-
- "Outputs" : {
- "ApiURL" : {
- "Description" : "API endpoint URL for Prod environment",
- "Value" : { "Fn::Sub" : "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" }
- },
- "S3ProxyBucket" : {
- "Value" : { "Fn::If" : ["CreateS3Bucket", {"Ref":"Bucket"}, { "Ref" : "BucketName" } ] }
- }
- }
+ "Outputs": {
+ "ApiURL": {
+ "Description": "API endpoint URL for Prod environment",
+ "Value": {
+ "Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
+ }
+ },
+ "S3ProxyBucket": {
+ "Value": {
+ "Fn::If": [
+ "CreateS3Bucket",
+ {
+ "Ref": "Bucket"
+ },
+ {
+ "Ref": "BucketName"
+ }
+ ]
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 66dcf573e..2236eba1b 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebAPI/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index e3a5f754d..32a9772b1 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -5,7 +5,7 @@
Lambda
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/appsettings.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/appsettings.json
index 5fff67bac..ef6dc62e9 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/appsettings.json
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/AspNetCoreWebApp/template/src/BlueprintBaseName.1/appsettings.json
@@ -2,7 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
- "Default": "Warning"
+ "Default": "Information"
}
}
}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/ChatBotTutorial/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/ChatBotTutorial/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 1e66fef6f..96a76e009 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/ChatBotTutorial/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/ChatBotTutorial/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -7,6 +7,6 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/blueprint-manifest.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/blueprint-manifest.json
new file mode 100644
index 000000000..b72be01e0
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/blueprint-manifest.json
@@ -0,0 +1,8 @@
+{
+ "display-name":"Custom Runtime Function",
+ "system-name":"CustomRuntimeFunction",
+ "description": "Use Lambda Custom Runtime feature to build Lambda functions using .NET Core 2.2 or 3.0.",
+ "sort-order" : 101,
+ "hidden-tags" : ["F#","LambdaProject"],
+ "tags":["Custom"]
+}
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/.template.config/template.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/.template.config/template.json
new file mode 100644
index 000000000..c2a9f961b
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/.template.config/template.json
@@ -0,0 +1,40 @@
+{
+ "author": "AWS",
+ "classifications": ["AWS", "Lambda", "Function"],
+ "name": "Lambda Custom Runtime Function",
+ "identity": "AWS.Lambda.Function.CustomRuntimeFunction.FSharp",
+ "groupIdentity": "AWS.Lambda.Function.CustomRuntimFunction",
+ "shortName": "lambda.CustomRuntimeFunction",
+ "tags": {
+ "language": "F#",
+ "type": "project"
+ },
+ "sourceName": "BlueprintBaseName.1",
+ "preferNameDirectory": true,
+ "symbols": {
+ "profile": {
+ "type": "parameter",
+ "description" : "The AWS credentials profile set in aws-lambda-tools-defaults.json and used as the default profile when interacting with AWS.",
+ "datatype": "string",
+ "replaces" : "DefaultProfile",
+ "defaultValue": ""
+ },
+ "region": {
+ "type": "parameter",
+ "description" : "The AWS region set in aws-lambda-tools-defaults.json and used as the default region when interacting with AWS.",
+ "datatype": "string",
+ "replaces" : "DefaultRegion",
+ "defaultValue": ""
+ },
+ "safe-sourcename": {
+ "type": "generated",
+ "generator": "coalesce",
+ "parameters": {
+ "sourceVariableName": "safe_namespace",
+ "fallbackVariableName": "safe_name"
+ },
+ "replaces": "BlueprintBaseName._1"
+ }
+ },
+ "primaryOutputs": [ { "path": "./src/BlueprintBaseName.1/BlueprintBaseName.1.csproj" } ]
+}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
new file mode 100644
index 000000000..2ea716786
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -0,0 +1,27 @@
+
+
+ Exe
+ netcoreapp2.2
+ Lambda
+
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Function.fs b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Function.fs
new file mode 100644
index 000000000..cb6bd0e3c
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Function.fs
@@ -0,0 +1,36 @@
+namespace BlueprintBaseName._1
+
+open Amazon.Lambda.Core
+open Amazon.Lambda.RuntimeSupport
+open Amazon.Lambda.Serialization.Json
+
+open System
+
+module Function =
+
+
+ ///
+ /// A simple function that takes a string and does a ToUpper
+ ///
+ /// To use this handler to respond to an AWS event, reference the appropriate package from
+ /// https://github.com/aws/aws-lambda-dotnet#events
+ /// and change the string input parameter to the desired event type.
+ ///
+ ///
+ ///
+ ///
+ let functionHandler (input: string) (_: ILambdaContext) =
+ match input with
+ | null -> String.Empty
+ | _ -> input.ToUpper()
+
+
+ []
+ let main _args =
+
+ let handler = Func(functionHandler)
+ use handlerWrapper = HandlerWrapper.GetHandlerWrapper(handler, new JsonSerializer())
+ use bootstrap = new LambdaBootstrap(handlerWrapper)
+
+ bootstrap.RunAsync().GetAwaiter().GetResult()
+ 0
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Readme.md b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Readme.md
new file mode 100644
index 000000000..3ee77acdb
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/Readme.md
@@ -0,0 +1,43 @@
+# AWS Lambda Custom Runtime Function Project
+
+This starter project consists of:
+* Function.fs - contains a main function that starts the bootstrap, and a single function handler
+* aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS
+* bootstrap - a Linux bash script that is invoked by the AWS Lambda infrastructure to start the function
+
+You may also have a test project depending on the options selected.
+
+The generated main function is the entry point for the function's process. The main function wraps the function handler in a wrapper that the bootstrap can work with. Then it instantiates the bootstrap and sets it up to call the function handler each time the AWS Lambda function is invoked. After the set up the bootstrap is started.
+
+The generated function handler is a simple function accepting a string argument that returns the uppercase equivalent of the input string. Replace the body of this function, and parameters, to suit your needs.
+
+## Here are some steps to follow from Visual Studio:
+
+(Deploying and invoking custom runtime functions is not yet available in Visual Studio)
+
+## Here are some steps to follow to get started from the command line:
+
+Once you have edited your template and code you can deploy your application using the [Amazon.Lambda.Tools Global Tool](https://github.com/aws/aws-extensions-for-dotnet-cli#aws-lambda-amazonlambdatools) from the command line. Version 3.1.4
+or later is required to deploy this project.
+
+Install Amazon.Lambda.Tools Global Tools if not already installed.
+```
+ dotnet tool install -g Amazon.Lambda.Tools
+```
+
+If already installed check if new version is available.
+```
+ dotnet tool update -g Amazon.Lambda.Tools
+```
+
+Execute unit tests
+```
+ cd "BlueprintBaseName/test/BlueprintBaseName.Tests"
+ dotnet test
+```
+
+Deploy function to AWS Lambda
+```
+ cd "BlueprintBaseName/src/BlueprintBaseName"
+ dotnet lambda deploy-function
+```
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json
new file mode 100644
index 000000000..f5d12b8b9
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json
@@ -0,0 +1,20 @@
+{
+ "Information" : [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+
+ "dotnet lambda help",
+
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+
+ "profile":"DefaultProfile",
+ "region" : "DefaultRegion",
+ "configuration" : "Release",
+ "function-runtime":"provided",
+ "function-memory-size" : 256,
+ "function-timeout" : 30,
+ "function-handler" : "not_required_for_custom_runtime",
+ "function-name" : "BlueprintBaseName.1",
+ "msbuild-parameters": "--self-contained true"
+ }
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/bootstrap b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/bootstrap
new file mode 100644
index 000000000..e16942ea7
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/src/BlueprintBaseName.1/bootstrap
@@ -0,0 +1,4 @@
+#!/bin/sh
+# This is the script that the Lambda host calls to start the custom runtime.
+
+/var/task/BlueprintBaseName.1
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
new file mode 100644
index 000000000..939a7be84
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -0,0 +1,21 @@
+
+
+ Library
+ false
+ netcoreapp2.2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/FunctionTest.fs b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/FunctionTest.fs
new file mode 100644
index 000000000..47e05ddbd
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction-FSharp/template/test/BlueprintBaseName.1.Tests/FunctionTest.fs
@@ -0,0 +1,20 @@
+namespace BlueprintBaseName._1.Tests
+
+
+open Xunit
+open Amazon.Lambda.TestUtilities
+open BlueprintBaseName._1
+
+
+module FunctionTest =
+
+ []
+ let ``Invoke ToUpper Lambda Function``() =
+ // Invoke the lambda function and confirm the string was upper cased.
+ let context = TestLambdaContext()
+ let upperCase = Function.functionHandler "hello world" context
+
+ Assert.Equal("HELLO WORLD", upperCase)
+
+ []
+ let main _ = 0
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/blueprint-manifest.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/blueprint-manifest.json
new file mode 100644
index 000000000..339841380
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/blueprint-manifest.json
@@ -0,0 +1,8 @@
+{
+ "display-name":"Custom Runtime Function",
+ "system-name":"CustomRuntimeFunction",
+ "description": "Use Lambda Custom Runtime feature to build Lambda functions using .NET Core 2.2 or 3.0.",
+ "sort-order" : 101,
+ "hidden-tags" : ["C#","LambdaProject"],
+ "tags":["Custom"]
+}
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/.template.config/template.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/.template.config/template.json
new file mode 100644
index 000000000..f1a7b09c5
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/.template.config/template.json
@@ -0,0 +1,40 @@
+{
+ "author": "AWS",
+ "classifications": ["AWS", "Lambda", "Function"],
+ "name": "Lambda Custom Runtime Function",
+ "identity": "AWS.Lambda.Function.CustomRuntimeFunction.CSharp",
+ "groupIdentity": "AWS.Lambda.Function.CustomRuntimFunction",
+ "shortName": "lambda.CustomRuntimeFunction",
+ "tags": {
+ "language": "C#",
+ "type": "project"
+ },
+ "sourceName": "BlueprintBaseName.1",
+ "preferNameDirectory": true,
+ "symbols": {
+ "profile": {
+ "type": "parameter",
+ "description" : "The AWS credentials profile set in aws-lambda-tools-defaults.json and used as the default profile when interacting with AWS.",
+ "datatype": "string",
+ "replaces" : "DefaultProfile",
+ "defaultValue": ""
+ },
+ "region": {
+ "type": "parameter",
+ "description" : "The AWS region set in aws-lambda-tools-defaults.json and used as the default region when interacting with AWS.",
+ "datatype": "string",
+ "replaces" : "DefaultRegion",
+ "defaultValue": ""
+ },
+ "safe-sourcename": {
+ "type": "generated",
+ "generator": "coalesce",
+ "parameters": {
+ "sourceVariableName": "safe_namespace",
+ "fallbackVariableName": "safe_name"
+ },
+ "replaces": "BlueprintBaseName._1"
+ }
+ },
+ "primaryOutputs": [ { "path": "./src/BlueprintBaseName.1/BlueprintBaseName.1.csproj" } ]
+}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
new file mode 100644
index 000000000..3268a670a
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -0,0 +1,18 @@
+
+
+ Exe
+ netcoreapp2.2
+ latest
+ Lambda
+
+
+
+ Always
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Function.cs b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Function.cs
new file mode 100644
index 000000000..c10244c40
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Function.cs
@@ -0,0 +1,40 @@
+using Amazon.Lambda.Core;
+using Amazon.Lambda.RuntimeSupport;
+using Amazon.Lambda.Serialization.Json;
+using System;
+using System.Threading.Tasks;
+
+namespace BlueprintBaseName._1
+{
+ public class Function
+ {
+ ///
+ /// The main entry point for the custom runtime.
+ ///
+ ///
+ private static async Task Main(string[] args)
+ {
+ Func func = FunctionHandler;
+ using(var handlerWrapper = HandlerWrapper.GetHandlerWrapper(func, new JsonSerializer()))
+ using(var bootstrap = new LambdaBootstrap(handlerWrapper))
+ {
+ await bootstrap.RunAsync();
+ }
+ }
+
+ ///
+ /// A simple function that takes a string and does a ToUpper
+ ///
+ /// To use this handler to respond to an AWS event, reference the appropriate package from
+ /// https://github.com/aws/aws-lambda-dotnet#events
+ /// and change the string input parameter to the desired event type.
+ ///
+ ///
+ ///
+ ///
+ public static string FunctionHandler(string input, ILambdaContext context)
+ {
+ return input?.ToUpper();
+ }
+ }
+}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Readme.md b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Readme.md
new file mode 100644
index 000000000..ea66fee1a
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/Readme.md
@@ -0,0 +1,43 @@
+# AWS Lambda Custom Runtime Function Project
+
+This starter project consists of:
+* Function.cs - contains a class with a Main method that starts the bootstrap, and a single function handler method
+* aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS
+* bootstrap - a Linux bash script that is invoked by the AWS Lambda infrastructure to start the function
+
+You may also have a test project depending on the options selected.
+
+The generated Main method is the entry point for the function's process. The main method wraps the function handler in a wrapper that the bootstrap can work with. Then it instantiates the bootstrap and sets it up to call the function handler each time the AWS Lambda function is invoked. After the set up the bootstrap is started.
+
+The generated function handler is a simple method accepting a string argument that returns the uppercase equivalent of the input string. Replace the body of this method, and parameters, to suit your needs.
+
+## Here are some steps to follow from Visual Studio:
+
+(Deploying and invoking custom runtime functions is not yet available in Visual Studio)
+
+## Here are some steps to follow to get started from the command line:
+
+Once you have edited your template and code you can deploy your application using the [Amazon.Lambda.Tools Global Tool](https://github.com/aws/aws-extensions-for-dotnet-cli#aws-lambda-amazonlambdatools) from the command line. Version 3.1.4
+or later is required to deploy this project.
+
+Install Amazon.Lambda.Tools Global Tools if not already installed.
+```
+ dotnet tool install -g Amazon.Lambda.Tools
+```
+
+If already installed check if new version is available.
+```
+ dotnet tool update -g Amazon.Lambda.Tools
+```
+
+Execute unit tests
+```
+ cd "BlueprintBaseName/test/BlueprintBaseName.Tests"
+ dotnet test
+```
+
+Deploy function to AWS Lambda
+```
+ cd "BlueprintBaseName/src/BlueprintBaseName"
+ dotnet lambda deploy-function
+```
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json
new file mode 100644
index 000000000..fdec294d9
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/aws-lambda-tools-defaults.json
@@ -0,0 +1,20 @@
+{
+ "Information" : [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+
+ "dotnet lambda help",
+
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+
+ "profile":"DefaultProfile",
+ "region" : "DefaultRegion",
+ "configuration" : "Release",
+ "framework" : "netcoreapp2.2",
+ "function-runtime":"provided",
+ "function-memory-size" : 256,
+ "function-timeout" : 30,
+ "function-handler" : "not_required_for_custom_runtime",
+ "msbuild-parameters": "--self-contained true"
+ }
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/bootstrap b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/bootstrap
new file mode 100644
index 000000000..e16942ea7
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/src/BlueprintBaseName.1/bootstrap
@@ -0,0 +1,4 @@
+#!/bin/sh
+# This is the script that the Lambda host calls to start the custom runtime.
+
+/var/task/BlueprintBaseName.1
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
new file mode 100644
index 000000000..84e96b144
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -0,0 +1,15 @@
+
+
+ netcoreapp2.2
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/FunctionTest.cs b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/FunctionTest.cs
new file mode 100644
index 000000000..e08cf47d5
--- /dev/null
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/CustomRuntimeFunction/template/test/BlueprintBaseName.1.Tests/FunctionTest.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+using Xunit;
+using Amazon.Lambda.Core;
+using Amazon.Lambda.TestUtilities;
+
+using BlueprintBaseName._1;
+
+namespace BlueprintBaseName._1.Tests
+{
+ public class FunctionTest
+ {
+ [Fact]
+ public void TestToUpperFunction()
+ {
+
+ // Invoke the lambda function and confirm the string was upper cased.
+ var context = new TestLambdaContext();
+ var upperCase = Function.FunctionHandler("hello world", context);
+
+ Assert.Equal("HELLO WORLD", upperCase);
+ }
+ }
+}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 91983d04f..44c6530d6 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -5,10 +5,10 @@
Lambda
-
-
+
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
index e94a45fa4..1dc328f09 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -12,7 +12,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 1acc0c498..16d7082a6 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -5,10 +5,10 @@
Lambda
-
-
+
+
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 3e5fdf144..3875b2bc8 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabels/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index cb0101e1d..fccbaeedb 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -5,10 +5,10 @@
Lambda
-
-
+
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
index e94a45fa4..1dc328f09 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -12,7 +12,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 1acc0c498..16d7082a6 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -5,10 +5,10 @@
Lambda
-
-
+
+
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 3e5fdf144..3875b2bc8 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DetectImageLabelsServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DynamoDBBlogAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DynamoDBBlogAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 9390e45db..19e993058 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DynamoDBBlogAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/DynamoDBBlogAPI/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -5,9 +5,9 @@
Lambda
-
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 4d60ddd94..b6f945f56 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -12,7 +12,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 45c85fd29..48b66be16 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,6 +6,6 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 78cf305d1..63834bb40 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -12,7 +12,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/serverless.template b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/serverless.template
index 32c03d685..1a8933ad0 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/serverless.template
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless-FSharp/template/src/BlueprintBaseName.1/serverless.template
@@ -16,7 +16,7 @@
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole" ],
"Events": {
- "PutResource": {
+ "RootGet": {
"Type": "Api",
"Properties": {
"Path": "/",
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 7814ca17b..e826b7874 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/serverless.template b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/serverless.template
index be979b521..1a8933ad0 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/serverless.template
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/EmptyServerless/template/src/BlueprintBaseName.1/serverless.template
@@ -6,7 +6,7 @@
"Resources" : {
"Get" : {
- "Type" : "AWS::Serverless::Function",
+ "Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "BlueprintBaseName.1::BlueprintBaseName._1.Functions::Get",
"Runtime": "dotnetcore2.1",
@@ -16,7 +16,7 @@
"Role": null,
"Policies": [ "AWSLambdaBasicExecutionRole" ],
"Events": {
- "PutResource": {
+ "RootGet": {
"Type": "Api",
"Properties": {
"Path": "/",
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index cdc0bb1d0..de83f0a80 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/appsettings.json b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/appsettings.json
index 09cf536c1..5ec73ff5b 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/appsettings.json
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/GiraffeWebApp-FSharp/template/src/BlueprintBaseName.1/appsettings.json
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
- "Default": "Warning"
+ "Default": "Information"
}
}
}
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/LexBookTripSample/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/LexBookTripSample/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 1e66fef6f..96a76e009 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/LexBookTripSample/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/LexBookTripSample/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -7,6 +7,6 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleApplicationLoadBalancer/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleApplicationLoadBalancer/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 8f6de297a..f1d4f404a 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleApplicationLoadBalancer/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleApplicationLoadBalancer/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index fc6b4fd61..64a852330 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
index 9ff865b5b..fb3bd0e8d 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index a199d280e..4187639c1 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,8 +6,8 @@
-
+
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 86a1eafb0..7c85a19ed 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleDynamoDBFunction/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFirehoseFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFirehoseFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 5363cbe54..4ca182823 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFirehoseFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFirehoseFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 5740d536c..966ebd033 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index ef52a310a..82275f3ae 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleKinesisFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index d9aa5f4e5..141c89458 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
index 14f794c17..6907c5e73 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 039865da0..4c4b24f53 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,8 +6,8 @@
-
+
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 24818a6bf..c47517978 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3Function/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 40bde0540..c5a2fc5f7 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
index 14f794c17..6907c5e73 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless-FSharp/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.fsproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 039865da0..4c4b24f53 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,8 +6,8 @@
-
+
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
index 24818a6bf..c47517978 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleS3FunctionServerless/template/test/BlueprintBaseName.1.Tests/BlueprintBaseName.1.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleSQSFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleSQSFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 310fc5464..ea94125c8 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleSQSFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/SimpleSQSFunction/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
index 004dee088..3bd9b3458 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld-FSharp/template/src/BlueprintBaseName.1/BlueprintBaseName.1.fsproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
index 45c85fd29..48b66be16 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/StepFunctionsHelloWorld/template/src/BlueprintBaseName.1/BlueprintBaseName.1.csproj
@@ -6,6 +6,6 @@
-
+
\ No newline at end of file
diff --git a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/template.nuspec b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/template.nuspec
index c047909ce..18238e675 100644
--- a/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/template.nuspec
+++ b/Blueprints/BlueprintDefinitions/Msbuild-NETCore_2_1/template.nuspec
@@ -2,9 +2,9 @@
Amazon.Lambda.Templates
- 3.5.1
+ 3.7.1Amazon Web Services
- AWS Amazon Lambda
+ AWS Amazon LambdaAWS Lambda templates for Microsoft Template Engine accessible with the dotnet CLI's new commanden-UShttps://github.com/aws/aws-lambda-dotnet
diff --git a/Blueprints/BlueprintPackager/BaseBlueprintPackager.cs b/Blueprints/BlueprintPackager/BaseBlueprintPackager.cs
index 4881db323..4ed9a956f 100644
--- a/Blueprints/BlueprintPackager/BaseBlueprintPackager.cs
+++ b/Blueprints/BlueprintPackager/BaseBlueprintPackager.cs
@@ -14,15 +14,46 @@ namespace Packager
public abstract class BaseBlueprintPackager
{
protected string _blueprintRoot;
+ protected IList _excludeBlueprints;
- public BaseBlueprintPackager(string blueprintRoot)
+ ///
+ /// Construct a new BaseBlueprintPackager.
+ ///
+ /// root to look for blueprint-manifest.json in
+ /// names of blueprints to exclude from this BaseBlueprintPackager
+ public BaseBlueprintPackager(string blueprintRoot, IList excludeBlueprints = null)
{
+ if (excludeBlueprints == null)
+ {
+ excludeBlueprints = new List();
+ }
+
this._blueprintRoot = blueprintRoot;
+ this._excludeBlueprints = excludeBlueprints;
}
protected IList SearchForblueprintManifests()
{
- return Directory.GetFiles(_blueprintRoot, "blueprint-manifest.json", SearchOption.AllDirectories).ToList();
- }
+ var temp = Directory.GetFiles(_blueprintRoot, "blueprint-manifest.json", SearchOption.AllDirectories);
+ var result = new List();
+ foreach(string possible in temp)
+ {
+ var include = true;
+ foreach (var excludeBlueprint in _excludeBlueprints)
+ {
+ if (Path.GetFileName(Path.GetDirectoryName(possible)) == excludeBlueprint)
+ {
+ include = false;
+ break;
+ }
+ }
+ if (include)
+ {
+ result.Add(possible);
+ }
+ }
+
+ return result;
+ }
}
}
\ No newline at end of file
diff --git a/Blueprints/BlueprintPackager/Program.cs b/Blueprints/BlueprintPackager/Program.cs
index 6b5318914..5830872c9 100644
--- a/Blueprints/BlueprintPackager/Program.cs
+++ b/Blueprints/BlueprintPackager/Program.cs
@@ -7,14 +7,19 @@ public class Program
{
public static void Main(string[] args)
{
+ ProcessArgs(args, out var updateVersions);
+
var outputDirectory = GetFullPath(@"../../Deployment/Blueprints");
var msbuildBased_2_1_Blueprints = GetFullPath(@"../BlueprintDefinitions/Msbuild-NETCore_2_1");
try
{
Init(outputDirectory);
- var versionUpdater = new UpdatePackageReferenceVersions(msbuildBased_2_1_Blueprints);
- versionUpdater.Execute();
+ if (updateVersions)
+ {
+ var versionUpdater = new UpdatePackageReferenceVersions(msbuildBased_2_1_Blueprints);
+ versionUpdater.Execute();
+ }
var vsMsbuildPackager_2_1 = new VSMsbuildBlueprintPackager(msbuildBased_2_1_Blueprints, Path.Combine(outputDirectory, "VisualStudioBlueprintsMsbuild_2_1"));
vsMsbuildPackager_2_1.Execute();
@@ -27,6 +32,21 @@ public static void Main(string[] args)
}
}
+ private static void ProcessArgs(string[] args, out bool updateVersions)
+ {
+ updateVersions = false;
+ if (args.Length == 1 && args[0] == "--updateVersions")
+ {
+ updateVersions = true;
+ }
+ else if (args.Length != 0)
+ {
+ Console.Error.WriteLine("usage: BlueprintPackager [--updateVersions]");
+ Console.Error.WriteLine("--updateVersions Run job to automatically update nuget package versions for template projects.");
+ Environment.Exit(-1);
+ }
+ }
+
public static string GetFullPath(string relativePath)
{
if (Directory.GetCurrentDirectory().Contains("Debug") || Directory.GetCurrentDirectory().Contains("Release"))
diff --git a/Blueprints/BlueprintPackager/VSMsbuildBlueprintPackager.cs b/Blueprints/BlueprintPackager/VSMsbuildBlueprintPackager.cs
index 13e130af0..5df2e92fc 100644
--- a/Blueprints/BlueprintPackager/VSMsbuildBlueprintPackager.cs
+++ b/Blueprints/BlueprintPackager/VSMsbuildBlueprintPackager.cs
@@ -12,12 +12,13 @@
namespace Packager
{
public class VSMsbuildBlueprintPackager : BaseBlueprintPackager
- {
-
+ {
+ private static IList ExcludeBlueprints = new List() { };
+
string _outputDirectory;
public VSMsbuildBlueprintPackager(string blueprintRoot, string outputDirectory)
- : base(blueprintRoot)
+ : base(blueprintRoot, ExcludeBlueprints)
{
_outputDirectory = outputDirectory; // Path.Combine(outputDirectory, "VisualStudioBlueprintsMsbuild");
if(!Directory.Exists(_outputDirectory))
diff --git a/Libraries/Libraries.sln b/Libraries/Libraries.sln
index d1f6cee10..2c5333698 100644
--- a/Libraries/Libraries.sln
+++ b/Libraries/Libraries.sln
@@ -79,7 +79,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellScriptsAsFunction
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Amazon.Lambda.CloudWatchEvents", "src\Amazon.Lambda.CloudWatchEvents\Amazon.Lambda.CloudWatchEvents.csproj", "{AD96AA48-2E1A-4BBB-9329-E1E484172FE3}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.Lambda.ApplicationLoadBalancerEvents", "src\Amazon.Lambda.ApplicationLoadBalancerEvents\Amazon.Lambda.ApplicationLoadBalancerEvents.csproj", "{0E743512-2FE4-40AD-935A-17B40ACF82C1}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Amazon.Lambda.ApplicationLoadBalancerEvents", "src\Amazon.Lambda.ApplicationLoadBalancerEvents\Amazon.Lambda.ApplicationLoadBalancerEvents.csproj", "{0E743512-2FE4-40AD-935A-17B40ACF82C1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Amazon.Lambda.RuntimeSupport", "src\Amazon.Lambda.RuntimeSupport\Amazon.Lambda.RuntimeSupport.csproj", "{0046EAB1-FA73-4D7A-A7CD-936E943F775E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Amazon.Lambda.RuntimeSupport.Tests", "Amazon.Lambda.RuntimeSupport.Tests", "{B5BD0336-7D08-492C-8489-42C987E29B39}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomRuntimeFunctionTest", "test\Amazon.Lambda.RuntimeSupport.Tests\CustomRuntimeFunctionTest\CustomRuntimeFunctionTest.csproj", "{61934DD2-CFBB-48E1-947C-75E8F736734C}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Amazon.Lambda.RuntimeSupport.IntegrationTests", "test\Amazon.Lambda.RuntimeSupport.Tests\Amazon.Lambda.RuntimeSupport.IntegrationTests\Amazon.Lambda.RuntimeSupport.IntegrationTests.csproj", "{39FD7632-73D0-4BB3-AE99-DC7B8B251E29}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Amazon.Lambda.RuntimeSupport.UnitTests", "test\Amazon.Lambda.RuntimeSupport.Tests\Amazon.Lambda.RuntimeSupport.UnitTests\Amazon.Lambda.RuntimeSupport.UnitTests.csproj", "{10E47FE4-8620-4933-A14D-E33F25CA557A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -215,6 +225,22 @@ Global
{0E743512-2FE4-40AD-935A-17B40ACF82C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E743512-2FE4-40AD-935A-17B40ACF82C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E743512-2FE4-40AD-935A-17B40ACF82C1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0046EAB1-FA73-4D7A-A7CD-936E943F775E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0046EAB1-FA73-4D7A-A7CD-936E943F775E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0046EAB1-FA73-4D7A-A7CD-936E943F775E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0046EAB1-FA73-4D7A-A7CD-936E943F775E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {61934DD2-CFBB-48E1-947C-75E8F736734C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {61934DD2-CFBB-48E1-947C-75E8F736734C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {61934DD2-CFBB-48E1-947C-75E8F736734C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {61934DD2-CFBB-48E1-947C-75E8F736734C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {39FD7632-73D0-4BB3-AE99-DC7B8B251E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39FD7632-73D0-4BB3-AE99-DC7B8B251E29}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39FD7632-73D0-4BB3-AE99-DC7B8B251E29}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39FD7632-73D0-4BB3-AE99-DC7B8B251E29}.Release|Any CPU.Build.0 = Release|Any CPU
+ {10E47FE4-8620-4933-A14D-E33F25CA557A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {10E47FE4-8620-4933-A14D-E33F25CA557A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {10E47FE4-8620-4933-A14D-E33F25CA557A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {10E47FE4-8620-4933-A14D-E33F25CA557A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -254,6 +280,11 @@ Global
{0AD1E5D6-AC23-47C1-97BF-227007021B6F} = {ADEC039D-0C34-4DA7-802B-6204FFE3F1F5}
{AD96AA48-2E1A-4BBB-9329-E1E484172FE3} = {AAB54E74-20B1-42ED-BC3D-CE9F7BC7FD12}
{0E743512-2FE4-40AD-935A-17B40ACF82C1} = {AAB54E74-20B1-42ED-BC3D-CE9F7BC7FD12}
+ {0046EAB1-FA73-4D7A-A7CD-936E943F775E} = {AAB54E74-20B1-42ED-BC3D-CE9F7BC7FD12}
+ {B5BD0336-7D08-492C-8489-42C987E29B39} = {1DE4EE60-45BA-4EF7-BE00-B9EB861E4C69}
+ {61934DD2-CFBB-48E1-947C-75E8F736734C} = {B5BD0336-7D08-492C-8489-42C987E29B39}
+ {39FD7632-73D0-4BB3-AE99-DC7B8B251E29} = {B5BD0336-7D08-492C-8489-42C987E29B39}
+ {10E47FE4-8620-4933-A14D-E33F25CA557A} = {B5BD0336-7D08-492C-8489-42C987E29B39}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {503678A4-B8D1-4486-8915-405A3E9CF0EB}
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs
index 9be308984..357dd72ef 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs
@@ -76,6 +76,7 @@ protected APIGatewayProxyFunction(AspNetCoreStartupMode startupMode)
}
+
///
///
///
@@ -86,16 +87,36 @@ protected APIGatewayProxyFunction(StartupMode startupMode)
}
-
- private protected override void InternalPostCreateContext(HostingApplication.Context context, APIGatewayProxyRequest apiGatewayRequest, ILambdaContext lambdaContext)
+ private protected override void InternalPostCreateContext(
+ HostingApplication.Context context,
+ APIGatewayProxyRequest apiGatewayRequest,
+ ILambdaContext lambdaContext)
{
- if (apiGatewayRequest?.RequestContext?.Authorizer?.Claims != null)
+ var authorizer = apiGatewayRequest?.RequestContext?.Authorizer;
+
+ if (authorizer != null)
{
- var identity = new ClaimsIdentity(apiGatewayRequest.RequestContext.Authorizer.Claims.Select(
- entry => new Claim(entry.Key, entry.Value.ToString())), "AuthorizerIdentity");
+ // handling claims output from cognito user pool authorizer
+ if (authorizer.Claims != null && authorizer.Claims.Count != 0)
+ {
+ var identity = new ClaimsIdentity(authorizer.Claims.Select(
+ entry => new Claim(entry.Key, entry.Value.ToString())), "AuthorizerIdentity");
- _logger.LogDebug($"Configuring HttpContext.User with {apiGatewayRequest.RequestContext.Authorizer.Claims.Count} claims coming from API Gateway's Request Context");
- context.HttpContext.User = new ClaimsPrincipal(identity);
+ lambdaContext.Logger.LogLine(
+ $"Configuring HttpContext.User with {authorizer.Claims.Count} claims coming from API Gateway's Request Context");
+ context.HttpContext.User = new ClaimsPrincipal(identity);
+ }
+ else
+ {
+ // handling claims output from custom lambda authorizer
+ var identity = new ClaimsIdentity(
+ authorizer.Where(x => !string.Equals(x.Key, "claims", StringComparison.OrdinalIgnoreCase))
+ .Select(entry => new Claim(entry.Key, entry.Value.ToString())), "AuthorizerIdentity");
+
+ lambdaContext.Logger.LogLine(
+ $"Configuring HttpContext.User with {authorizer.Count} claims coming from API Gateway's Request Context");
+ context.HttpContext.User = new ClaimsPrincipal(identity);
+ }
}
}
@@ -115,12 +136,13 @@ private protected override void InternalCustomResponseExceptionHandling(HostingA
protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxyRequest apiGatewayRequest, ILambdaContext lambdaContext)
{
{
- var requestFeatures = (IHttpRequestFeature)features;
+ var requestFeatures = (IHttpRequestFeature) features;
requestFeatures.Scheme = "https";
requestFeatures.Method = apiGatewayRequest.HttpMethod;
string path = null;
- if (apiGatewayRequest.PathParameters != null && apiGatewayRequest.PathParameters.ContainsKey("proxy") && !string.IsNullOrEmpty(apiGatewayRequest.Resource))
+ if (apiGatewayRequest.PathParameters != null && apiGatewayRequest.PathParameters.ContainsKey("proxy") &&
+ !string.IsNullOrEmpty(apiGatewayRequest.Resource))
{
var proxyPath = apiGatewayRequest.PathParameters["proxy"];
path = apiGatewayRequest.Resource.Replace("{proxy+}", proxyPath);
@@ -157,14 +179,15 @@ protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxy
if (requestContextPath.EndsWith(path))
{
- requestFeatures.PathBase = requestContextPath.Substring(0, requestContextPath.Length - requestFeatures.Path.Length);
+ requestFeatures.PathBase = requestContextPath.Substring(0,
+ requestContextPath.Length - requestFeatures.Path.Length);
}
}
requestFeatures.Path = Utilities.DecodeResourcePath(requestFeatures.Path);
- requestFeatures.QueryString = Utilities.CreateQueryStringParamaters(
- apiGatewayRequest.QueryStringParameters, apiGatewayRequest.MultiValueQueryStringParameters);
+ requestFeatures.QueryString = Utilities.CreateQueryStringParameters(
+ apiGatewayRequest.QueryStringParameters, apiGatewayRequest.MultiValueQueryStringParameters, true);
Utilities.SetHeadersCollection(requestFeatures.Headers, apiGatewayRequest.Headers, apiGatewayRequest.MultiValueHeaders);
@@ -190,7 +213,7 @@ protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxy
{
// set up connection features
- var connectionFeatures = (IHttpConnectionFeature)features;
+ var connectionFeatures = (IHttpConnectionFeature) features;
if (!string.IsNullOrEmpty(apiGatewayRequest?.RequestContext?.Identity?.SourceIp) &&
IPAddress.TryParse(apiGatewayRequest.RequestContext.Identity.SourceIp, out var remoteIpAddress))
@@ -207,7 +230,6 @@ protected override void MarshallRequest(InvokeFeatures features, APIGatewayProxy
// was marshalled into ASP.NET Core request.
PostMarshallConnectionFeature(connectionFeatures, apiGatewayRequest, lambdaContext);
}
-
}
///
@@ -261,4 +283,4 @@ protected override APIGatewayProxyResponse MarshallResponse(IHttpResponseFeature
return response;
}
}
-}
+}
\ No newline at end of file
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction{TStartup}.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction{TStartup}.cs
index 7758104be..7a2e3b93b 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction{TStartup}.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction{TStartup}.cs
@@ -10,6 +10,26 @@ namespace Amazon.Lambda.AspNetCoreServer
/// The type containing the startup methods for the application.
public abstract class APIGatewayProxyFunction : APIGatewayProxyFunction where TStartup : class
{
+ ///
+ /// Default Constructor. The ASP.NET Core Framework will be initialized as part of the construction.
+ ///
+ protected APIGatewayProxyFunction()
+ : base()
+ {
+
+ }
+
+
+ ///
+ ///
+ ///
+ /// Configure when the ASP.NET Core framework will be initialized
+ protected APIGatewayProxyFunction(StartupMode startupMode)
+ : base(startupMode)
+ {
+
+ }
+
///
protected override IWebHostBuilder CreateWebHostBuilder() =>
base.CreateWebHostBuilder().UseStartup();
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs
index 787be9916..b77c39ecc 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs
@@ -168,9 +168,10 @@ protected virtual IWebHostBuilder CreateWebHostBuilder()
})
.ConfigureLogging((hostingContext, logging) =>
{
+ logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
+
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("LAMBDA_TASK_ROOT")))
{
- logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
}
@@ -207,6 +208,8 @@ protected void Start()
_host = builder.Build();
+ PostCreateWebHost(_host);
+
_host.Start();
_server = _host.Services.GetService(typeof(Microsoft.AspNetCore.Hosting.Server.IServer)) as LambdaServer;
@@ -397,6 +400,16 @@ private protected virtual void InternalCustomResponseExceptionHandling(HostingAp
}
+ ///
+ /// This methid is called after the IWebHost is created from the IWebHostBuilder and the services have been configured. The
+ /// WebHost hasn't been started yet.
+ ///
+ ///
+ protected virtual void PostCreateWebHost(IWebHost webHost)
+ {
+
+ }
+
///
/// This method is called after the HostingApplication.Context has been created. Derived classes can overwrite this method to alter
/// the context before passing the request to ASP.NET Core to process the request.
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj b/Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj
index d78811d3e..eb8539c8e 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj
@@ -6,7 +6,7 @@
Amazon.Lambda.AspNetCoreServer makes it easy to run ASP.NET Core Web API applications as AWS Lambda functions.netstandard2.0Amazon.Lambda.AspNetCoreServer
- 3.0.1
+ 3.0.4Amazon.Lambda.AspNetCoreServerAmazon.Lambda.AspNetCoreServerAWS;Amazon;Lambda;aspnetcore
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction.cs
index ec830e5f0..91b4f1ac8 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction.cs
@@ -64,8 +64,8 @@ protected override void MarshallRequest(InvokeFeatures features, ApplicationLoad
requestFeatures.Method = lambdaRequest.HttpMethod;
requestFeatures.Path = Utilities.DecodeResourcePath(lambdaRequest.Path);
- requestFeatures.QueryString = Utilities.CreateQueryStringParamaters(
- lambdaRequest.QueryStringParameters, lambdaRequest.MultiValueQueryStringParameters);
+ requestFeatures.QueryString = Utilities.CreateQueryStringParameters(
+ lambdaRequest.QueryStringParameters, lambdaRequest.MultiValueQueryStringParameters, false);
Utilities.SetHeadersCollection(requestFeatures.Headers, lambdaRequest.Headers, lambdaRequest.MultiValueHeaders);
@@ -74,6 +74,15 @@ protected override void MarshallRequest(InvokeFeatures features, ApplicationLoad
requestFeatures.Body = Utilities.ConvertLambdaRequestBodyToAspNetCoreBody(lambdaRequest.Body, lambdaRequest.IsBase64Encoded);
}
+ var userAgent = GetSingleHeaderValue(lambdaRequest, "user-agent");
+ if (userAgent != null && userAgent.StartsWith("ELB-HealthChecker/", StringComparison.OrdinalIgnoreCase))
+ {
+ requestFeatures.Scheme = "https";
+ requestFeatures.Headers["host"] = "localhost";
+ requestFeatures.Headers["x-forwarded-port"] = "443";
+ requestFeatures.Headers["x-forwarded-for"] = "127.0.0.1";
+ }
+
// Call consumers customize method in case they want to change how API Gateway's request
// was marshalled into ASP.NET Core request.
PostMarshallRequestFeature(requestFeatures, lambdaRequest, lambdaContext);
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction{TStartup}.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction{TStartup}.cs
index 4939ed1d9..75e199e34 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction{TStartup}.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/ApplicationLoadBalancerFunction{TStartup}.cs
@@ -10,6 +10,26 @@ namespace Amazon.Lambda.AspNetCoreServer
/// The type containing the startup methods for the application.
public abstract class ApplicationLoadBalancerFunction : ApplicationLoadBalancerFunction where TStartup : class
{
+ ///
+ /// Default Constructor. The ASP.NET Core Framework will be initialized as part of the construction.
+ ///
+ protected ApplicationLoadBalancerFunction()
+ : base()
+ {
+
+ }
+
+
+ ///
+ ///
+ ///
+ /// Configure when the ASP.NET Core framework will be initialized
+ protected ApplicationLoadBalancerFunction(StartupMode startupMode)
+ : base(startupMode)
+ {
+
+ }
+
///
protected override IWebHostBuilder CreateWebHostBuilder() =>
base.CreateWebHostBuilder().UseStartup();
diff --git a/Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/Utilities.cs b/Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/Utilities.cs
index 26bdd4574..648c6c777 100644
--- a/Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/Utilities.cs
+++ b/Libraries/src/Amazon.Lambda.AspNetCoreServer/Internal/Utilities.cs
@@ -65,7 +65,7 @@ internal static (string body, bool isBase64Encoded) ConvertAspNetCoreBodyToLambd
}
}
- internal static string CreateQueryStringParamaters(IDictionary singleValues, IDictionary> multiValues)
+ internal static string CreateQueryStringParameters(IDictionary singleValues, IDictionary> multiValues, bool urlEncodeValue)
{
if (multiValues?.Count > 0)
{
@@ -78,7 +78,7 @@ internal static string CreateQueryStringParamaters(IDictionary s
{
sb.Append("&");
}
- sb.Append($"{kvp.Key}={value}");
+ sb.Append($"{kvp.Key}={(urlEncodeValue ? WebUtility.UrlEncode(value) : value)}");
}
}
return sb.ToString();
@@ -95,7 +95,7 @@ internal static string CreateQueryStringParamaters(IDictionary s
{
sb.Append("&");
}
- sb.Append($"{kvp.Key}={kvp.Value}");
+ sb.Append($"{kvp.Key}={(urlEncodeValue ? WebUtility.UrlEncode(kvp.Value) : kvp.Value)}");
}
return sb.ToString();
}
@@ -120,16 +120,13 @@ internal static void SetHeadersCollection(IHeaderDictionary headers, IDictionary
headers[kvp.Key] = new StringValues(kvp.Value);
}
}
-
}
- internal static string DecodeResourcePath(string resourcePath)
- {
- // Convert any + signs to percent encoding before url decoding the path.
- resourcePath = resourcePath.Replace("+", "%2B");
- resourcePath = resourcePath = WebUtility.UrlDecode(resourcePath);
-
- return resourcePath;
- }
+ internal static string DecodeResourcePath(string resourcePath) => WebUtility.UrlDecode(resourcePath
+ // Convert any + signs to percent encoding before URL decoding the path.
+ .Replace("+", "%2B")
+ // Double-escape any %2F (encoded / characters) so that they survive URL decoding the path.
+ .Replace("%2F", "%252F")
+ .Replace("%2f", "%252f"));
}
}
diff --git a/Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj b/Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj
index 12274e644..8e046d555 100644
--- a/Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj
+++ b/Libraries/src/Amazon.Lambda.Logging.AspNetCore/Amazon.Lambda.Logging.AspNetCore.csproj
@@ -6,7 +6,7 @@
Amazon Lambda .NET Core support - Logging ASP.NET Core package.netstandard2.0Amazon.Lambda.Logging.AspNetCore
- 2.1.0
+ 2.2.0Amazon.Lambda.Logging.AspNetCoreAmazon.Lambda.Logging.AspNetCoreAWS;Amazon;Lambda;Logging
diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj b/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj
new file mode 100644
index 000000000..df69819f0
--- /dev/null
+++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj
@@ -0,0 +1,26 @@
+
+
+
+
+
+ netstandard2.0
+ 1.0.0
+ Provides a bootstrap and Lambda Runtime API Client to help you to develop custom .NET Core Lambda Runtimes.
+ Amazon.Lambda.RuntimeSupport
+ Amazon.Lambda.RuntimeSupport
+ Amazon.Lambda.RuntimeSupport
+ AWS;Amazon;Lambda
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/HandlerWrapper.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/HandlerWrapper.cs
new file mode 100644
index 000000000..1da2ebe18
--- /dev/null
+++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/HandlerWrapper.cs
@@ -0,0 +1,722 @@
+/*
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+using Amazon.Lambda.Core;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Amazon.Lambda.RuntimeSupport
+{
+ ///
+ /// This class provides methods that help you wrap existing C# Lambda implementations with LambdaBootstrapHandler delegates.
+ /// This makes serialization and deserialization simpler and allows you to use existing functions them with an instance of LambdaBootstrap.
+ ///
+ public class HandlerWrapper : IDisposable
+ {
+ private static readonly InvocationResponse EmptyInvocationResponse =
+ new InvocationResponse(new MemoryStream(0), false);
+
+ private MemoryStream OutputStream = new MemoryStream();
+
+ public LambdaBootstrapHandler Handler { get; private set; }
+
+ private HandlerWrapper(LambdaBootstrapHandler handler)
+ {
+ Handler = handler;
+ }
+
+ private HandlerWrapper() { }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler();
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ await handler();
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler(Stream)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ await handler(invocation.InputStream);
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler(PocoIn)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ await handler(input);
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler(ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ await handler(invocation.LambdaContext);
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler(Stream, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ await handler(invocation.InputStream, invocation.LambdaContext);
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ await handler(input, invocation.LambdaContext);
+ return EmptyInvocationResponse;
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler()
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ return new InvocationResponse(await handler());
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler(Stream)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ return new InvocationResponse(await handler(invocation.InputStream));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler(PocoIn)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ return new InvocationResponse(await handler(input));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler(ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ return new InvocationResponse(await handler(invocation.LambdaContext));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler(Stream, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ return new InvocationResponse(await handler(invocation.InputStream, invocation.LambdaContext));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<Stream> Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper(async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ return new InvocationResponse(await handler(input, invocation.LambdaContext));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler()
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TOutput output = await handler();
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler(Stream)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TOutput output = await handler(invocation.InputStream);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler(PocoIn)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ TOutput output = await handler(input);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler(ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TOutput output = await handler(invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0; ;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler(Stream, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TOutput output = await handler(invocation.InputStream, invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Task<PocoOut> Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func> handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = async (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ TOutput output = await handler(input, invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return new InvocationResponse(handlerWrapper.OutputStream, false);
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler()
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ handler();
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler(Stream)
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ handler(invocation.InputStream);
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler(PocoIn)
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ handler(input);
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler(ILambdaContext)
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ handler(invocation.LambdaContext);
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler(Stream, ILambdaContext)
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ handler(invocation.InputStream, invocation.LambdaContext);
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: void Handler(PocoIn, ILambdaContext)
+ ///
+ /// Action called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Action handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ handler(input, invocation.LambdaContext);
+ return Task.FromResult(EmptyInvocationResponse);
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler()
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ return Task.FromResult(new InvocationResponse(handler()));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler(Stream)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ return Task.FromResult(new InvocationResponse(handler(invocation.InputStream)));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler(PocoIn)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ return Task.FromResult(new InvocationResponse(handler(input)));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler(ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ return Task.FromResult(new InvocationResponse(handler(invocation.LambdaContext)));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ return Task.FromResult(new InvocationResponse(handler(invocation.InputStream, invocation.LambdaContext)));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: Stream Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ return new HandlerWrapper((invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ return Task.FromResult(new InvocationResponse(handler(input, invocation.LambdaContext)));
+ });
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler()
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TOutput output = handler();
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler(Stream)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TOutput output = handler(invocation.InputStream);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler(PocoIn)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ TOutput output = handler(input);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler(ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TOutput output = handler(invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0; ;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler(Stream, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TOutput output = handler(invocation.InputStream, invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ ///
+ /// Get a HandlerWrapper that will call the given method on function invocation.
+ /// Note that you may have to cast your handler to its specific type to help the compiler.
+ /// Example handler signature: PocoOut Handler(PocoIn, ILambdaContext)
+ ///
+ /// Func called for each invocation of the Lambda function.
+ /// ILambdaSerializer to use when calling the handler
+ /// A HandlerWrapper
+ public static HandlerWrapper GetHandlerWrapper(Func handler, ILambdaSerializer serializer)
+ {
+ var handlerWrapper = new HandlerWrapper();
+ handlerWrapper.Handler = (invocation) =>
+ {
+ TInput input = serializer.Deserialize(invocation.InputStream);
+ TOutput output = handler(input, invocation.LambdaContext);
+ handlerWrapper.OutputStream.SetLength(0);
+ serializer.Serialize(output, handlerWrapper.OutputStream);
+ handlerWrapper.OutputStream.Position = 0;
+ return Task.FromResult(new InvocationResponse(handlerWrapper.OutputStream, false));
+ };
+ return handlerWrapper;
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // To detect redundant calls
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ OutputStream.Dispose();
+ }
+
+ disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ #endregion
+ }
+}
diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs
new file mode 100644
index 000000000..655d1170c
--- /dev/null
+++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+using System;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Amazon.Lambda.RuntimeSupport
+{
+ public delegate Task LambdaBootstrapHandler(InvocationRequest invocation);
+ public delegate Task LambdaBootstrapInitializer();
+
+ ///
+ /// Class to communicate with the Lambda Runtime API, handle initialization,
+ /// and run the invoke loop for an AWS Lambda function
+ ///
+ public class LambdaBootstrap : IDisposable
+ {
+ ///
+ /// The Lambda container freezes the process at a point where an HTTP request is in progress.
+ /// We need to make sure we don't timeout waiting for the next invocation.
+ ///
+ private static readonly TimeSpan RuntimeApiHttpTimeout = TimeSpan.FromHours(12);
+
+ private LambdaBootstrapInitializer _initializer;
+ private LambdaBootstrapHandler _handler;
+
+ private HttpClient _httpClient;
+ internal IRuntimeApiClient Client { get; set; }
+
+ ///
+ /// Create a LambdaBootstrap that will call the given initializer and handler.
+ ///
+ /// Delegate called for each invocation of the Lambda function.
+ /// Delegate called to initialize the Lambda function. If not provided the initialization step is skipped.
+ ///
+ public LambdaBootstrap(LambdaBootstrapHandler handler, LambdaBootstrapInitializer initializer = null)
+ {
+ _handler = handler ?? throw new ArgumentNullException(nameof(handler));
+ _initializer = initializer;
+ _httpClient = new HttpClient
+ {
+ Timeout = RuntimeApiHttpTimeout
+ };
+ Client = new RuntimeApiClient(new SystemEnvironmentVariables(), _httpClient);
+ }
+
+ ///
+ /// Create a LambdaBootstrap that will call the given initializer and handler.
+ ///
+ /// The HandlerWrapper to call for each invocation of the Lambda function.
+ /// Delegate called to initialize the Lambda function. If not provided the initialization step is skipped.
+ ///
+ public LambdaBootstrap(HandlerWrapper handlerWrapper, LambdaBootstrapInitializer initializer = null)
+ : this(handlerWrapper.Handler, initializer)
+ { }
+
+ ///
+ /// Run the initialization Func if provided.
+ /// Then run the invoke loop, calling the handler for each invocation.
+ ///
+ ///
+ /// A Task that represents the operation.
+ public async Task RunAsync(CancellationToken cancellationToken = default(CancellationToken))
+ {
+ bool doStartInvokeLoop = _initializer == null || await InitializeAsync();
+
+ while (doStartInvokeLoop && !cancellationToken.IsCancellationRequested)
+ {
+ await InvokeOnceAsync();
+ }
+ }
+
+ internal async Task InitializeAsync()
+ {
+ try
+ {
+ return await _initializer();
+ }
+ catch (Exception exception)
+ {
+ await Client.ReportInitializationErrorAsync(exception);
+ throw;
+ }
+ }
+
+ internal async Task InvokeOnceAsync()
+ {
+ using (var invocation = await Client.GetNextInvocationAsync())
+ {
+ InvocationResponse response = null;
+ bool invokeSucceeded = false;
+
+ try
+ {
+ response = await _handler(invocation);
+ invokeSucceeded = true;
+ }
+ catch (Exception exception)
+ {
+ await Client.ReportInvocationErrorAsync(invocation.LambdaContext.AwsRequestId, exception);
+ }
+
+ if (invokeSucceeded)
+ {
+ try
+ {
+ await Client.SendResponseAsync(invocation.LambdaContext.AwsRequestId, response?.OutputStream);
+ }
+ finally
+ {
+ if (response != null && response.DisposeOutputStream)
+ {
+ response.OutputStream?.Dispose();
+ }
+ }
+ }
+ }
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // To detect redundant calls
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ _httpClient?.Dispose();
+ }
+ disposedValue = true;
+ }
+ }
+
+ // This code added to correctly implement the disposable pattern.
+ public void Dispose()
+ {
+ // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
+ Dispose(true);
+ }
+ #endregion
+ }
+}
diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/IRuntimeApiClient.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/IRuntimeApiClient.cs
new file mode 100644
index 000000000..f2579f97b
--- /dev/null
+++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/IRuntimeApiClient.cs
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+using Amazon.Lambda.Core;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Amazon.Lambda.RuntimeSupport
+{
+ ///
+ /// Client to call the AWS Lambda Runtime API.
+ ///
+ public interface IRuntimeApiClient
+ {
+ ///
+ /// Report an initialization error as an asynchronous operation.
+ ///
+ /// The exception to report.
+ /// A Task representing the asynchronous operation.
+ Task ReportInitializationErrorAsync(Exception exception);
+
+ ///
+ /// Send an initialization error with a type string but no other information as an asynchronous operation.
+ /// This can be used to directly control flow in Step Functions without creating an Exception class and throwing it.
+ ///
+ /// The type of the error to report to Lambda. This does not need to be a .NET type name.
+ /// A Task representing the asynchronous operation.
+ Task ReportInitializationErrorAsync(string errorType);
+
+ ///
+ /// Get the next function invocation from the Runtime API as an asynchronous operation.
+ /// Completes when the next invocation is received.
+ ///
+ /// A Task representing the asynchronous operation.
+ Task GetNextInvocationAsync();
+
+ ///
+ /// Report an invocation error as an asynchronous operation.
+ ///
+ /// The ID of the function request that caused the error.
+ /// The exception to report.
+ /// A Task representing the asynchronous operation.
+ Task ReportInvocationErrorAsync(string awsRequestId, Exception exception);
+
+ ///
+ /// Send an initialization error with a type string but no other information as an asynchronous operation.
+ /// This can be used to directly control flow in Step Functions without creating an Exception class and throwing it.
+ ///
+ /// The ID of the function request that caused the error.
+ /// The type of the error to report to Lambda. This does not need to be a .NET type name.
+ /// A Task representing the asynchronous operation.
+ Task ReportInvocationErrorAsync(string awsRequestId, string errorType);
+
+ ///
+ /// Send a response to a function invocation to the Runtime API as an asynchronous operation.
+ ///
+ /// The ID of the function request being responded to.
+ /// The content of the response to the function invocation.
+ ///
+ Task SendResponseAsync(string awsRequestId, Stream outputStream);
+ }
+}
\ No newline at end of file
diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/InternalClientAdapted.cs b/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/InternalClientAdapted.cs
new file mode 100644
index 000000000..7645e49bd
--- /dev/null
+++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/Client/InternalClientAdapted.cs
@@ -0,0 +1,669 @@
+/*
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+/*
+ * This file was originally generated using NSwag.
+ * The original generated file is InternalClientGenerated.txt.
+ * This code has been adapted to:
+ * 1. Use an internal copy of LitJson to avoid dependency collision with consumers.
+ * 2. Allow streams to be sent directly as a response, instead of assuming the response is JSON.
+ * 3. Customize based on AWS Lambda specific nuances. (See comments in runtime-api.yaml)
+ */
+
+namespace Amazon.Lambda.RuntimeSupport
+{
+
+ internal partial interface IInternalRuntimeApiClient
+ {
+ /// Non-recoverable initialization error. Runtime should exit after reporting the error. Error will be served in response to the first invoke.
+ /// Accepted
+ /// A server side error occurred.
+ System.Threading.Tasks.Task> ErrorAsync(string lambda_Runtime_Function_Error_Type, string errorJson);
+
+ /// Non-recoverable initialization error. Runtime should exit after reporting the error. Error will be served in response to the first invoke.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ System.Threading.Tasks.Task> ErrorAsync(string lambda_Runtime_Function_Error_Type, string errorJson, System.Threading.CancellationToken cancellationToken);
+
+ /// Runtime makes this HTTP request when it is ready to receive and process a new invoke.
+ /// This is an iterator-style blocking API call. Response contains event JSON document, specific to the invoking service.
+ /// A server side error occurred.
+ System.Threading.Tasks.Task> NextAsync();
+
+ /// Runtime makes this HTTP request when it is ready to receive and process a new invoke.
+ /// This is an iterator-style blocking API call. Response contains event JSON document, specific to the invoking service.
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ System.Threading.Tasks.Task> NextAsync(System.Threading.CancellationToken cancellationToken);
+
+ /// Runtime makes this request in order to submit a response.
+ /// Accepted
+ /// A server side error occurred.
+ System.Threading.Tasks.Task> ResponseAsync(string awsRequestId, System.IO.Stream outputStream);
+
+ /// Runtime makes this request in order to submit a response.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ System.Threading.Tasks.Task> ResponseAsync(string awsRequestId, System.IO.Stream outputStream, System.Threading.CancellationToken cancellationToken);
+
+ /// Runtime makes this request in order to submit an error response. It can be either a function error, or a runtime error. Error will be served in response to the invoke.
+ /// Accepted
+ /// A server side error occurred.
+ System.Threading.Tasks.Task> Error2Async(string awsRequestId, string lambda_Runtime_Function_Error_Type, string errorJson);
+
+ /// Runtime makes this request in order to submit an error response. It can be either a function error, or a runtime error. Error will be served in response to the invoke.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ System.Threading.Tasks.Task> Error2Async(string awsRequestId, string lambda_Runtime_Function_Error_Type, string errorJson, System.Threading.CancellationToken cancellationToken);
+
+ }
+
+ internal partial class InternalRuntimeApiClient : IInternalRuntimeApiClient
+ {
+ private const string ErrorContentType = "application/vnd.aws.lambda.error+json";
+
+ private string _baseUrl = "/2018-06-01";
+ private System.Net.Http.HttpClient _httpClient;
+
+ public InternalRuntimeApiClient(System.Net.Http.HttpClient httpClient)
+ {
+ _httpClient = httpClient;
+ }
+
+ public string BaseUrl
+ {
+ get { return _baseUrl; }
+ set { _baseUrl = value; }
+ }
+
+ partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
+ partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
+ partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
+
+ /// Non-recoverable initialization error. Runtime should exit after reporting the error. Error will be served in response to the first invoke.
+ /// Accepted
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task> ErrorAsync(string lambda_Runtime_Function_Error_Type, string errorJson)
+ {
+ return ErrorAsync(lambda_Runtime_Function_Error_Type, errorJson, System.Threading.CancellationToken.None);
+ }
+
+ /// Non-recoverable initialization error. Runtime should exit after reporting the error. Error will be served in response to the first invoke.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ public async System.Threading.Tasks.Task> ErrorAsync(string lambda_Runtime_Function_Error_Type, string errorJson, System.Threading.CancellationToken cancellationToken)
+ {
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/runtime/init/error");
+
+ var client_ = _httpClient;
+ try
+ {
+ using (var request_ = new System.Net.Http.HttpRequestMessage())
+ {
+ if (lambda_Runtime_Function_Error_Type != null)
+ request_.Headers.TryAddWithoutValidation("Lambda-Runtime-Function-Error-Type", ConvertToString(lambda_Runtime_Function_Error_Type, System.Globalization.CultureInfo.InvariantCulture));
+ using (var content_ = new System.Net.Http.StringContent(errorJson))
+ {
+ content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(ErrorContentType);
+ request_.Content = content_;
+ request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = ((int)response_.StatusCode).ToString();
+ if (status_ == "202")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(StatusResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ return new SwaggerResponse((int)response_.StatusCode, headers_, result_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ }
+ else
+ if (status_ == "403")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Forbidden", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "500")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("Container error. Non-recoverable state. Runtime should exit promptly.\n", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+ else
+ if (status_ != "200" && status_ != "204")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+
+ return new SwaggerResponse((int)response_.StatusCode, headers_, default(StatusResponse));
+ }
+ finally
+ {
+ if (response_ != null)
+ response_.Dispose();
+ }
+ }
+ }
+ }
+ finally
+ {
+ }
+ }
+
+ /// Runtime makes this HTTP request when it is ready to receive and process a new invoke.
+ /// This is an iterator-style blocking API call. Response contains event JSON document, specific to the invoking service.
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task> NextAsync()
+ {
+ return NextAsync(System.Threading.CancellationToken.None);
+ }
+
+ /// Runtime makes this HTTP request when it is ready to receive and process a new invoke.
+ /// This is an iterator-style blocking API call. Response contains event JSON document, specific to the invoking service.
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ public async System.Threading.Tasks.Task> NextAsync(System.Threading.CancellationToken cancellationToken)
+ {
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/runtime/invocation/next");
+
+ var client_ = _httpClient;
+ try
+ {
+ using (var request_ = new System.Net.Http.HttpRequestMessage())
+ {
+ request_.Method = new System.Net.Http.HttpMethod("GET");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = ((int)response_.StatusCode).ToString();
+ if (status_ == "200")
+ {
+ var inputBuffer = response_.Content == null ? null : await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
+ return new SwaggerResponse((int)response_.StatusCode, headers_, new System.IO.MemoryStream(inputBuffer));
+ }
+ else
+ if (status_ == "403")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Forbidden", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "500")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("Container error. Non-recoverable state. Runtime should exit promptly.\n", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+ else
+ if (status_ != "200" && status_ != "204")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+
+ return new SwaggerResponse((int)response_.StatusCode, headers_, new System.IO.MemoryStream(0));
+ }
+ finally
+ {
+ if (response_ != null)
+ response_.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ }
+ }
+
+ /// Runtime makes this request in order to submit a response.
+ /// Accepted
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task> ResponseAsync(string awsRequestId, System.IO.Stream outputStream)
+ {
+ return ResponseAsync(awsRequestId, outputStream, System.Threading.CancellationToken.None);
+ }
+
+ /// Runtime makes this request in order to submit a response.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ public async System.Threading.Tasks.Task> ResponseAsync(string awsRequestId, System.IO.Stream outputStream, System.Threading.CancellationToken cancellationToken)
+ {
+ if (awsRequestId == null)
+ throw new System.ArgumentNullException("awsRequestId");
+
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/runtime/invocation/{AwsRequestId}/response");
+ urlBuilder_.Replace("{AwsRequestId}", System.Uri.EscapeDataString(ConvertToString(awsRequestId, System.Globalization.CultureInfo.InvariantCulture)));
+
+ var client_ = _httpClient;
+ try
+ {
+ var request_ = new System.Net.Http.HttpRequestMessage();
+ {
+ var content_ = outputStream == null ?
+ (System.Net.Http.HttpContent)new System.Net.Http.StringContent(string.Empty) :
+ (System.Net.Http.HttpContent)new System.Net.Http.StreamContent(new NonDisposingStreamWrapper(outputStream));
+
+ try
+ {
+ content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ request_.Content = content_;
+ request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = ((int)response_.StatusCode).ToString();
+ if (status_ == "202")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(StatusResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ return new SwaggerResponse((int)response_.StatusCode, headers_, result_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ }
+ else
+ if (status_ == "400")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Bad Request", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "403")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Forbidden", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "413")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Payload Too Large", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "500")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("Container error. Non-recoverable state. Runtime should exit promptly.\n", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+ else
+ if (status_ != "200" && status_ != "204")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+
+ return new SwaggerResponse((int)response_.StatusCode, headers_, default(StatusResponse));
+ }
+ finally
+ {
+ if (response_ != null)
+ response_.Dispose();
+ }
+ }
+ finally
+ {
+ content_?.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ }
+ }
+
+ /// Runtime makes this request in order to submit an error response. It can be either a function error, or a runtime error. Error will be served in response to the invoke.
+ /// Accepted
+ /// A server side error occurred.
+ public System.Threading.Tasks.Task> Error2Async(string awsRequestId, string lambda_Runtime_Function_Error_Type, string errorJson)
+ {
+ return Error2Async(awsRequestId, lambda_Runtime_Function_Error_Type, errorJson, System.Threading.CancellationToken.None);
+ }
+
+ /// Runtime makes this request in order to submit an error response. It can be either a function error, or a runtime error. Error will be served in response to the invoke.
+ /// Accepted
+ /// A server side error occurred.
+ /// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
+ public async System.Threading.Tasks.Task> Error2Async(string awsRequestId, string lambda_Runtime_Function_Error_Type, string errorJson, System.Threading.CancellationToken cancellationToken)
+ {
+ if (awsRequestId == null)
+ throw new System.ArgumentNullException("awsRequestId");
+
+ var urlBuilder_ = new System.Text.StringBuilder();
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/runtime/invocation/{AwsRequestId}/error");
+ urlBuilder_.Replace("{AwsRequestId}", System.Uri.EscapeDataString(ConvertToString(awsRequestId, System.Globalization.CultureInfo.InvariantCulture)));
+
+ var client_ = _httpClient;
+ try
+ {
+ using (var request_ = new System.Net.Http.HttpRequestMessage())
+ {
+ if (lambda_Runtime_Function_Error_Type != null)
+ request_.Headers.TryAddWithoutValidation("Lambda-Runtime-Function-Error-Type", ConvertToString(lambda_Runtime_Function_Error_Type, System.Globalization.CultureInfo.InvariantCulture));
+ using (var content_ = new System.Net.Http.StringContent(errorJson))
+ {
+ content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(ErrorContentType);
+ request_.Content = content_;
+ request_.Method = new System.Net.Http.HttpMethod("POST");
+ request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
+
+ PrepareRequest(client_, request_, urlBuilder_);
+ var url_ = urlBuilder_.ToString();
+ request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
+ PrepareRequest(client_, request_, url_);
+
+ var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ try
+ {
+ var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
+ if (response_.Content != null && response_.Content.Headers != null)
+ {
+ foreach (var item_ in response_.Content.Headers)
+ headers_[item_.Key] = item_.Value;
+ }
+
+ ProcessResponse(client_, response_);
+
+ var status_ = ((int)response_.StatusCode).ToString();
+ if (status_ == "202")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(StatusResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ return new SwaggerResponse((int)response_.StatusCode, headers_, result_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ }
+ else
+ if (status_ == "400")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Bad Request", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "403")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ var result_ = default(ErrorResponse);
+ try
+ {
+ result_ = ThirdParty.Json.LitJson.JsonMapper.ToObject(responseData_);
+ }
+ catch (System.Exception exception_)
+ {
+ throw new RuntimeApiClientException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
+ }
+ throw new RuntimeApiClientException("Forbidden", (int)response_.StatusCode, responseData_, headers_, result_, null);
+ }
+ else
+ if (status_ == "500")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("Container error. Non-recoverable state. Runtime should exit promptly.\n", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+ else
+ if (status_ != "200" && status_ != "204")
+ {
+ var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
+ throw new RuntimeApiClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
+ }
+
+ return new SwaggerResponse((int)response_.StatusCode, headers_, default(StatusResponse));
+ }
+ finally
+ {
+ if (response_ != null)
+ response_.Dispose();
+ }
+ }
+ }
+ }
+ finally
+ {
+ }
+ }
+
+ private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo)
+ {
+ if (value is System.Enum)
+ {
+ string name = System.Enum.GetName(value.GetType(), value);
+ if (name != null)
+ {
+ var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
+ if (field != null)
+ {
+ var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
+ as System.Runtime.Serialization.EnumMemberAttribute;
+ if (attribute != null)
+ {
+ return attribute.Value;
+ }
+ }
+ }
+ }
+ else if (value is bool)
+ {
+ return System.Convert.ToString(value, cultureInfo).ToLowerInvariant();
+ }
+ else if (value is byte[])
+ {
+ return System.Convert.ToBase64String((byte[])value);
+ }
+ else if (value != null && value.GetType().IsArray)
+ {
+ var array = System.Linq.Enumerable.OfType