-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
524 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
24 changes: 24 additions & 0 deletions
24
...ntimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/AnalyzeSentimentFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
{ | ||
|
||
/// <summary> | ||
/// A simple function that takes a string and does a ToUpper | ||
/// </summary> | ||
/// <param name="input"></param> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
public string FunctionHandler(string input, ILambdaContext context) | ||
{ | ||
return input.ToUpper(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...entimentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/FsaAnalyzeSentiment.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | ||
<AWSProjectType>Lambda</AWSProjectType> | ||
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. --> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<!-- Generate ready to run images during publishing to improve cold start time. --> | ||
<PublishReadyToRun>true</PublishReadyToRun> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" /> | ||
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" /> | ||
</ItemGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
...mentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...mentAnalyzer/FeedbackSentimentAnalyzer/FsaAnalyzeSentiment/aws-lambda-tools-defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
65 changes: 65 additions & 0 deletions
65
...FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/ExtractTextFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
|
||
/// <summary> | ||
/// 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. | ||
/// </summary> | ||
public ExtractTextFunction() | ||
{ | ||
S3Client = new AmazonS3Client(); | ||
} | ||
|
||
/// <summary> | ||
/// Constructs an instance with a preconfigured S3 client. This can be used for testing the outside of the Lambda environment. | ||
/// </summary> | ||
/// <param name="s3Client"></param> | ||
public ExtractTextFunction(IAmazonS3 s3Client) | ||
{ | ||
this.S3Client = s3Client; | ||
} | ||
|
||
/// <summary> | ||
/// 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. | ||
/// </summary> | ||
/// <param name="evnt"></param> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
public async Task<string?> 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; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/FsaExtractText.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | ||
<AWSProjectType>Lambda</AWSProjectType> | ||
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. --> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<!-- Generate ready to run images during publishing to improve cold start time. --> | ||
<PublishReadyToRun>true</PublishReadyToRun> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" /> | ||
<PackageReference Include="Amazon.Lambda.S3Events" Version="3.0.1" /> | ||
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" /> | ||
<PackageReference Include="AWSSDK.S3" Version="3.7.205.3" /> | ||
</ItemGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
...SentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...SentimentAnalyzer/FeedbackSentimentAnalyzer/FsaExtractText/aws-lambda-tools-defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
10 changes: 10 additions & 0 deletions
10
...3/cross-service/FeedbackSentimentAnalyzer/FeedbackSentimentAnalyzer/FsaServices/Class1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.