diff --git a/applications/feedback_sentiment_analyzer/cdk/lib/functions.ts b/applications/feedback_sentiment_analyzer/cdk/lib/functions.ts index a326fa69c02..4c430c44013 100644 --- a/applications/feedback_sentiment_analyzer/cdk/lib/functions.ts +++ b/applications/feedback_sentiment_analyzer/cdk/lib/functions.ts @@ -214,110 +214,49 @@ const JAVA_FUNCTIONS: AppFunctionConfig[] = [ }, ]; -const DOTNET_FUNCTIONS = [ +const DOTNET_FUNCTION_CONFIG = { + ...BASE_APP_FUNCTION, + runtime: Runtime.DOTNET_6, + codeAsset: () => { + const source = resolve("../../../dotnetv3/cross-service/FeedbackSentimentAnalyzer"); + return Code.fromAsset(source, { + bundling: { + command: [ + "/bin/sh", + "-c", + " dotnet tool install -g Amazon.Lambda.Tools" + + " && dotnet build" + + " && cd PamApi" + + " && dotnet lambda package --output-package /asset-output/function.zip", + ], + image: Runtime.DOTNET_6.bundlingImage, + user: "root", + outputType: BundlingOutput.ARCHIVED, + }, + }); + }, +}; + +const DOTNET_FUNCTIONS: AppFunctionConfig[] = [ { - ...BASE_APP_FUNCTION, + ...DOTNET_FUNCTION_CONFIG, name: "ExtractText", - handler: "FsaExtractText::FsaExtractText.ExtractTextFunction::FunctionHandler", - runtime: Runtime.DOTNET_6, - codeAsset() { - const source = resolve( - "../../../dotnetv3/cross-service/FeedbackSentimentAnalyzer" - ); - return Code.fromAsset(source, { - bundling: { - command: [ - "/bin/sh", - "-c", - " dotnet tool install -g Amazon.Lambda.Tools" + - " && dotnet build" + - " && cd FsaExtractText" + - " && dotnet lambda package --output-package /asset-output/function.zip", - ], - image: Runtime.DOTNET_6.bundlingImage, - user: "root", - outputType: BundlingOutput.ARCHIVED, - }, - }); - }, + handler: "com.example.fsa.handlers.ExtractTextHandler::handleRequest", }, { - ...BASE_APP_FUNCTION, + ...COMMON_JAVA_FUNCTION_CONFIG, name: "AnalyzeSentiment", - handler: "FsaAnalyzeSentiment::FsaAnalyzeSentiment.AnalyzeSentimentFunction::FunctionHandler", - runtime: Runtime.DOTNET_6, - codeAsset() { - const source = resolve( - "../../../dotnetv3/cross-service/FeedbackSentimentAnalyzer" - ); - return Code.fromAsset(source, { - bundling: { - command: [ - "/bin/sh", - "-c", - " dotnet tool install -g Amazon.Lambda.Tools" + - " && dotnet build" + - " && cd FsaAnalyzeSentiment" + - " && dotnet lambda package --output-package /asset-output/function.zip", - ], - image: Runtime.DOTNET_6.bundlingImage, - user: "root", - outputType: BundlingOutput.ARCHIVED, - }, - }); - }, + handler: "com.example.fsa.handlers.AnalyzeSentimentHandler::handleRequest", }, { - ...BASE_APP_FUNCTION, + ...COMMON_JAVA_FUNCTION_CONFIG, name: "TranslateText", - handler: "FsaTranslateText::FsaTranslateText.TranslateTextFunction::FunctionHandler", - runtime: Runtime.DOTNET_6, - codeAsset() { - const source = resolve( - "../../../dotnetv3/cross-service/FeedbackSentimentAnalyzer" - ); - return Code.fromAsset(source, { - bundling: { - command: [ - "/bin/sh", - "-c", - " dotnet tool install -g Amazon.Lambda.Tools" + - " && dotnet build" + - " && cd FsaTranslateText" + - " && dotnet lambda package --output-package /asset-output/function.zip", - ], - image: Runtime.DOTNET_6.bundlingImage, - user: "root", - outputType: BundlingOutput.ARCHIVED, - }, - }); - }, + handler: "com.example.fsa.handlers.TranslateTextHandler::handleRequest", }, { - ...BASE_APP_FUNCTION, + ...COMMON_JAVA_FUNCTION_CONFIG, name: "SynthesizeAudio", - handler: "FsaSynthesizeAudio::FsaSynthesizeAudio.SynthesizeAudioFunction::FunctionHandler", - runtime: Runtime.DOTNET_6, - codeAsset() { - const source = resolve( - "../../../dotnetv3/cross-service/FeedbackSentimentAnalyzer" - ); - return Code.fromAsset(source, { - bundling: { - command: [ - "/bin/sh", - "-c", - " dotnet tool install -g Amazon.Lambda.Tools" + - " && dotnet build" + - " && cd FsaSynthesizeAudio" + - " && dotnet lambda package --output-package /asset-output/function.zip", - ], - image: Runtime.DOTNET_6.bundlingImage, - user: "root", - outputType: BundlingOutput.ARCHIVED, - }, - }); - }, + handler: "com.example.fsa.handlers.SynthesizeAudioHandler::handleRequest", }, ]; diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer.sln b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer.sln new file mode 100644 index 00000000000..64b38fcadfc --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer.sln @@ -0,0 +1,55 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33927.249 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FsaExtractText", "FsaExtractText\FsaExtractText.csproj", "{C0BB9701-7EE8-4A91-B1EB-B3888ED43079}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FsaAnalyzeSentiment", "FsaAnalyzeSentiment\FsaAnalyzeSentiment.csproj", "{9B31C723-D4B0-4953-B5B1-9002E7181DEB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FsaTranslateText", "FsaTranslateText\FsaTranslateText.csproj", "{9886D38A-541E-4BF5-83CE-6CA85088028B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FsaSynthesizeAudio", "FsaSynthesizeAudio\FsaSynthesizeAudio.csproj", "{4613C012-D517-4C57-98A3-F59B727889EE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FsaServices", "FsaServices\FsaServices.csproj", "{DA3393CC-DBBF-444E-947C-FBDC4BA66C55}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FsaServicesTest", "FsaServicesTest\FsaServicesTest.csproj", "{3A3503C4-9077-4BB3-90C9-08A2B8ED798D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C0BB9701-7EE8-4A91-B1EB-B3888ED43079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C0BB9701-7EE8-4A91-B1EB-B3888ED43079}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0BB9701-7EE8-4A91-B1EB-B3888ED43079}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C0BB9701-7EE8-4A91-B1EB-B3888ED43079}.Release|Any CPU.Build.0 = Release|Any CPU + {9B31C723-D4B0-4953-B5B1-9002E7181DEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B31C723-D4B0-4953-B5B1-9002E7181DEB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B31C723-D4B0-4953-B5B1-9002E7181DEB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B31C723-D4B0-4953-B5B1-9002E7181DEB}.Release|Any CPU.Build.0 = Release|Any CPU + {9886D38A-541E-4BF5-83CE-6CA85088028B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9886D38A-541E-4BF5-83CE-6CA85088028B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9886D38A-541E-4BF5-83CE-6CA85088028B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9886D38A-541E-4BF5-83CE-6CA85088028B}.Release|Any CPU.Build.0 = Release|Any CPU + {4613C012-D517-4C57-98A3-F59B727889EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4613C012-D517-4C57-98A3-F59B727889EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4613C012-D517-4C57-98A3-F59B727889EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4613C012-D517-4C57-98A3-F59B727889EE}.Release|Any CPU.Build.0 = Release|Any CPU + {DA3393CC-DBBF-444E-947C-FBDC4BA66C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA3393CC-DBBF-444E-947C-FBDC4BA66C55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA3393CC-DBBF-444E-947C-FBDC4BA66C55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA3393CC-DBBF-444E-947C-FBDC4BA66C55}.Release|Any CPU.Build.0 = Release|Any CPU + {3A3503C4-9077-4BB3-90C9-08A2B8ED798D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A3503C4-9077-4BB3-90C9-08A2B8ED798D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A3503C4-9077-4BB3-90C9-08A2B8ED798D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A3503C4-9077-4BB3-90C9-08A2B8ED798D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C7E557C4-6C58-4B38-8C84-D71A72BD3F3C} + EndGlobalSection +EndGlobal diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/AnalyzeSentimentFunction.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/AnalyzeSentimentFunction.cs new file mode 100644 index 00000000000..5763208c2a7 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/AnalyzeSentimentFunction.cs @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using Amazon.Lambda.Core; + +// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace FsaAnalyzeSentiment; + +public class AnalyzeSentimentFunction +{ + + /// + /// A simple function that takes a string and does a ToUpper + /// + /// + /// + /// + public string FunctionHandler(string input, ILambdaContext context) + { + return input.ToUpper(); + } +} diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/FsaAnalyzeSentiment.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/FsaAnalyzeSentiment.csproj new file mode 100644 index 00000000000..786c2c9c103 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/FsaAnalyzeSentiment.csproj @@ -0,0 +1,17 @@ + + + net6.0 + enable + enable + true + Lambda + + true + + true + + + + + + \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/Properties/launchSettings.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/Properties/launchSettings.json new file mode 100644 index 00000000000..a82d4042b00 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Mock Lambda Test Tool": { + "commandName": "Executable", + "commandLineArgs": "--port 5050", + "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + } + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/aws-lambda-tools-defaults.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/aws-lambda-tools-defaults.json new file mode 100644 index 00000000000..0d983abd15d --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/aws-lambda-tools-defaults.json @@ -0,0 +1,15 @@ +{ + "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": "default", + "region": "us-west-2", + "configuration": "Release", + "function-runtime": "dotnet6", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "FsaAnalyzeSentiment::FsaAnalyzeSentiment.Function::FunctionHandler" +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/ExtractTextFunction.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/ExtractTextFunction.cs new file mode 100644 index 00000000000..86185be3784 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/ExtractTextFunction.cs @@ -0,0 +1,65 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using Amazon.Lambda.Core; +using Amazon.Lambda.S3Events; +using Amazon.S3; +using Amazon.S3.Util; + +// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace FsaExtractText; + +public class ExtractTextFunction +{ + IAmazonS3 S3Client { get; set; } + + /// + /// Default constructor. This constructor is used by Lambda to construct the instance. When invoked in a Lambda environment + /// the AWS credentials will come from the IAM role associated with the function and the AWS region will be set to the + /// region the Lambda function is executed in. + /// + public ExtractTextFunction() + { + S3Client = new AmazonS3Client(); + } + + /// + /// Constructs an instance with a preconfigured S3 client. This can be used for testing the outside of the Lambda environment. + /// + /// + public ExtractTextFunction(IAmazonS3 s3Client) + { + this.S3Client = s3Client; + } + + /// + /// This method is called for every Lambda invocation. This method takes in an S3 event object and can be used + /// to respond to S3 notifications. + /// + /// + /// + /// + public async Task FunctionHandler(S3Event evnt, ILambdaContext context) + { + var s3Event = evnt.Records?[0].S3; + if (s3Event == null) + { + return null; + } + + try + { + var response = await this.S3Client.GetObjectMetadataAsync(s3Event.Bucket.Name, s3Event.Object.Key); + return response.Headers.ContentType; + } + catch (Exception e) + { + context.Logger.LogInformation($"Error getting object {s3Event.Object.Key} from bucket {s3Event.Bucket.Name}. Make sure they exist and your bucket is in the same region as this function."); + context.Logger.LogInformation(e.Message); + context.Logger.LogInformation(e.StackTrace); + throw; + } + } +} diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/FsaExtractText.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/FsaExtractText.csproj new file mode 100644 index 00000000000..85bf6b0f64c --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/FsaExtractText.csproj @@ -0,0 +1,19 @@ + + + net6.0 + enable + enable + true + Lambda + + true + + true + + + + + + + + \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/Properties/launchSettings.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/Properties/launchSettings.json new file mode 100644 index 00000000000..a82d4042b00 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Mock Lambda Test Tool": { + "commandName": "Executable", + "commandLineArgs": "--port 5050", + "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + } + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/aws-lambda-tools-defaults.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/aws-lambda-tools-defaults.json new file mode 100644 index 00000000000..a3d807b875c --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/aws-lambda-tools-defaults.json @@ -0,0 +1,15 @@ +{ + "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": "default", + "region": "us-west-2", + "configuration": "Release", + "function-runtime": "dotnet6", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "FsaExtractText::FsaExtractText.Function::FunctionHandler" +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/Class1.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/Class1.cs new file mode 100644 index 00000000000..cfbaf4967fe --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/Class1.cs @@ -0,0 +1,10 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +namespace FsaServices +{ + public class Class1 + { + + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/ExtractTextService.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/ExtractTextService.cs new file mode 100644 index 00000000000..21f33bbc13f --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/ExtractTextService.cs @@ -0,0 +1,48 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using Amazon.Textract; +using Amazon.Textract.Model; + +namespace FsaServices; + +/// +/// Service to handle extracting text from images. +/// +public class ExtractTextService +{ + private readonly IAmazonTextract _amazonTextract; + + /// + /// Constructor that uses the injected Amazon Textract client. + /// + /// Amazon Textract client. + public ExtractTextService(IAmazonTextract amazonTextract) + { + _amazonTextract = amazonTextract; + } + + /// + /// + /// + /// + /// + /// + public async Task ExtractWordsFromBucketObject(string bucket, string name) + { + var detectTextResponse = await _amazonTextract.DetectDocumentTextAsync( + new DetectDocumentTextRequest() + { + Document = new Document() + { + S3Object = new S3Object() { Bucket = bucket, Name = name } + } + }); + + var words = detectTextResponse.Blocks + .Where(b => b.BlockType == BlockType.WORD) + .Select(w => w.Text); + + return string.Join(' ', words); + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/FsaServices.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/FsaServices.csproj new file mode 100644 index 00000000000..020c30e1f75 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/FsaServices.csproj @@ -0,0 +1,16 @@ + + + + net6.0 + enable + enable + + + + + + + + + + diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/SentimentService.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/SentimentService.cs new file mode 100644 index 00000000000..abdcea94cd0 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/SentimentService.cs @@ -0,0 +1,14 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FsaServices; + +public class SentimentService +{ +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/FsaServicesTest.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/FsaServicesTest.csproj new file mode 100644 index 00000000000..c5d106357d8 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/FsaServicesTest.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/UnitTest1.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/UnitTest1.cs new file mode 100644 index 00000000000..63bd2e54128 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/UnitTest1.cs @@ -0,0 +1,14 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +namespace FsaServicesTest +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + + } + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/Usings.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/Usings.cs new file mode 100644 index 00000000000..92fe41799a7 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServicesTest/Usings.cs @@ -0,0 +1,4 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +global using Xunit; \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/FsaSynthesizeAudio.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/FsaSynthesizeAudio.csproj new file mode 100644 index 00000000000..786c2c9c103 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/FsaSynthesizeAudio.csproj @@ -0,0 +1,17 @@ + + + net6.0 + enable + enable + true + Lambda + + true + + true + + + + + + \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/Properties/launchSettings.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/Properties/launchSettings.json new file mode 100644 index 00000000000..a82d4042b00 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Mock Lambda Test Tool": { + "commandName": "Executable", + "commandLineArgs": "--port 5050", + "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + } + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/SynthesizeAudioFunction.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/SynthesizeAudioFunction.cs new file mode 100644 index 00000000000..ce60171a6f4 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/SynthesizeAudioFunction.cs @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using Amazon.Lambda.Core; + +// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace FsaSynthesizeAudio; + +public class SynthesizeAudioFunction +{ + + /// + /// A simple function that takes a string and does a ToUpper + /// + /// + /// + /// + public string FunctionHandler(string input, ILambdaContext context) + { + return input.ToUpper(); + } +} diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/aws-lambda-tools-defaults.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/aws-lambda-tools-defaults.json new file mode 100644 index 00000000000..a80a6d8fdcc --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaSynthesizeAudio/aws-lambda-tools-defaults.json @@ -0,0 +1,15 @@ +{ + "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": "default", + "region": "us-west-2", + "configuration": "Release", + "function-runtime": "dotnet6", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "FsaSynthesizeAudio::FsaSynthesizeAudio.Function::FunctionHandler" +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/FsaTranslateText.csproj b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/FsaTranslateText.csproj new file mode 100644 index 00000000000..786c2c9c103 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/FsaTranslateText.csproj @@ -0,0 +1,17 @@ + + + net6.0 + enable + enable + true + Lambda + + true + + true + + + + + + \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/Properties/launchSettings.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/Properties/launchSettings.json new file mode 100644 index 00000000000..a82d4042b00 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Mock Lambda Test Tool": { + "commandName": "Executable", + "commandLineArgs": "--port 5050", + "workingDirectory": ".\\bin\\$(Configuration)\\net6.0", + "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" + } + } +} \ No newline at end of file diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/TranslateTextFunction.cs b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/TranslateTextFunction.cs new file mode 100644 index 00000000000..d0854aee790 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/TranslateTextFunction.cs @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using Amazon.Lambda.Core; + +// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. +[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] + +namespace FsaTranslateText; + +public class TranslateTextFunction +{ + + /// + /// A simple function that takes a string and does a ToUpper + /// + /// + /// + /// + public string FunctionHandler(string input, ILambdaContext context) + { + return input.ToUpper(); + } +} diff --git a/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/aws-lambda-tools-defaults.json b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/aws-lambda-tools-defaults.json new file mode 100644 index 00000000000..87cfa6ac3e2 --- /dev/null +++ b/dotnetv3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaTranslateText/aws-lambda-tools-defaults.json @@ -0,0 +1,15 @@ +{ + "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": "default", + "region": "us-west-2", + "configuration": "Release", + "function-runtime": "dotnet6", + "function-memory-size": 256, + "function-timeout": 30, + "function-handler": "FsaTranslateText::FsaTranslateText.Function::FunctionHandler" +} \ No newline at end of file