Skip to content

Commit

Permalink
Merge pull request #1 from aws/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
karpikpl committed May 30, 2019
2 parents 8d25d2e + 1a76fa0 commit d68ea22
Show file tree
Hide file tree
Showing 166 changed files with 12,149 additions and 526 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<None Include="serverless.template" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.1" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.4" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning"
"Default": "Information"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
<PackageReference Include="AWSSDK.S3" Version="3.3.31.15" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.6" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.1" />
<PackageReference Include="AWSSDK.S3" Version="3.3.101.11" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.100.1" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"Lambda.Logging": {
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Information"
"Default": "Information"
}
},
"AppS3Bucket": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="1.2.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.6" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.100.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.1" />
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="3.0.4" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
"Default": "Information"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.LexEvents" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.4.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.5.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -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"]
}
Original file line number Diff line number Diff line change
@@ -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" } ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
<ItemGroup>
<Content Include="bootstrap">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="Function.fs" />
</ItemGroup>
<ItemGroup>
<Content Include="aws-lambda-tools-defaults.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.0.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.5.0" />
</ItemGroup>
<ItemGroup>
<Content Include="aws-lambda-tools-defaults.json" />
<None Include="Readme.md" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace BlueprintBaseName._1

open Amazon.Lambda.Core
open Amazon.Lambda.RuntimeSupport
open Amazon.Lambda.Serialization.Json

open System

module Function =


/// <summary>
/// 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.
/// </summary>
/// <param name="input"></param>
/// <param name="context"></param>
/// <returns></returns>
let functionHandler (input: string) (_: ILambdaContext) =
match input with
| null -> String.Empty
| _ -> input.ToUpper()


[<EntryPoint>]
let main _args =

let handler = Func<string, ILambdaContext, string>(functionHandler)
use handlerWrapper = HandlerWrapper.GetHandlerWrapper(handler, new JsonSerializer())
use bootstrap = new LambdaBootstrap(handlerWrapper)

bootstrap.RunAsync().GetAwaiter().GetResult()
0
Loading

0 comments on commit d68ea22

Please sign in to comment.