Skip to content

chore: initial folder structure #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
435 changes: 435 additions & 0 deletions libaries/.gitignore

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions libaries/AWS.Lambda.Powertools.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{00578DF3-A86D-4DB6-AD6E-EAD17A6ED401}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2BA3A979-B60B-4C87-B2EA-5E8D0F5C59DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools", "src\Amazon.LambdaPowertools\Amazon.LambdaPowertools.csproj", "{4151C755-3E94-4A44-9E99-757A1F618839}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Logging", "src\Amazon.LambdaPowertools.Logging\Amazon.LambdaPowertools.Logging.csproj", "{FFE2462F-37C2-491D-98A0-130A70F1D262}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Metrics", "src\Amazon.LambdaPowertools.Metrics\Amazon.LambdaPowertools.Metrics.csproj", "{76158EC2-7E1D-42F9-961D-552A7326D3E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Tracing", "src\Amazon.LambdaPowertools.Tracing\Amazon.LambdaPowertools.Tracing.csproj", "{E9A5465C-914A-4B09-B76D-C02DE3469287}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Logging.Tests", "tests\Amazon.LambdaPowertools.Logging.Tests\Amazon.LambdaPowertools.Logging.Tests.csproj", "{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Metrics.Tests", "tests\Amazon.LambdaPowertools.Metrics.Tests\Amazon.LambdaPowertools.Metrics.Tests.csproj", "{F963F435-6CC6-49A1-81D9-229E44F4B52B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Amazon.LambdaPowertools.Tracing.Tests", "tests\Amazon.LambdaPowertools.Tracing.Tests\Amazon.LambdaPowertools.Tracing.Tests.csproj", "{72C51B5E-A5CE-4399-9543-CB8FA053E156}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4151C755-3E94-4A44-9E99-757A1F618839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4151C755-3E94-4A44-9E99-757A1F618839}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4151C755-3E94-4A44-9E99-757A1F618839}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4151C755-3E94-4A44-9E99-757A1F618839}.Release|Any CPU.Build.0 = Release|Any CPU
{FFE2462F-37C2-491D-98A0-130A70F1D262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFE2462F-37C2-491D-98A0-130A70F1D262}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFE2462F-37C2-491D-98A0-130A70F1D262}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFE2462F-37C2-491D-98A0-130A70F1D262}.Release|Any CPU.Build.0 = Release|Any CPU
{76158EC2-7E1D-42F9-961D-552A7326D3E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76158EC2-7E1D-42F9-961D-552A7326D3E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76158EC2-7E1D-42F9-961D-552A7326D3E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76158EC2-7E1D-42F9-961D-552A7326D3E1}.Release|Any CPU.Build.0 = Release|Any CPU
{E9A5465C-914A-4B09-B76D-C02DE3469287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9A5465C-914A-4B09-B76D-C02DE3469287}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9A5465C-914A-4B09-B76D-C02DE3469287}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9A5465C-914A-4B09-B76D-C02DE3469287}.Release|Any CPU.Build.0 = Release|Any CPU
{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D}.Release|Any CPU.Build.0 = Release|Any CPU
{F963F435-6CC6-49A1-81D9-229E44F4B52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F963F435-6CC6-49A1-81D9-229E44F4B52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F963F435-6CC6-49A1-81D9-229E44F4B52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F963F435-6CC6-49A1-81D9-229E44F4B52B}.Release|Any CPU.Build.0 = Release|Any CPU
{72C51B5E-A5CE-4399-9543-CB8FA053E156}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72C51B5E-A5CE-4399-9543-CB8FA053E156}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72C51B5E-A5CE-4399-9543-CB8FA053E156}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72C51B5E-A5CE-4399-9543-CB8FA053E156}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4151C755-3E94-4A44-9E99-757A1F618839} = {00578DF3-A86D-4DB6-AD6E-EAD17A6ED401}
{FFE2462F-37C2-491D-98A0-130A70F1D262} = {00578DF3-A86D-4DB6-AD6E-EAD17A6ED401}
{76158EC2-7E1D-42F9-961D-552A7326D3E1} = {00578DF3-A86D-4DB6-AD6E-EAD17A6ED401}
{E9A5465C-914A-4B09-B76D-C02DE3469287} = {00578DF3-A86D-4DB6-AD6E-EAD17A6ED401}
{C98AFCD0-B9A0-42D1-97C0-7A82D408B93D} = {2BA3A979-B60B-4C87-B2EA-5E8D0F5C59DC}
{F963F435-6CC6-49A1-81D9-229E44F4B52B} = {2BA3A979-B60B-4C87-B2EA-5E8D0F5C59DC}
{72C51B5E-A5CE-4399-9543-CB8FA053E156} = {2BA3A979-B60B-4C87-B2EA-5E8D0F5C59DC}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Logging/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace Amazon.LambdaPowertools.Logging
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Metrics/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace Amazon.LambdaPowertools.Metrics
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
19 changes: 19 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Tracing/CaptureHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;

namespace Amazon.LambdaPowertools.Tracing
{
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class CaptureHandler : Attribute
{
public CaptureHandler(ITracerOptions options)
{
// not implemented
}

public CaptureHandler(string service = "undefined", bool disabled = false, bool autoPatch = true,
string patchmodules = null)
{
// not implemented
}
}
}
27 changes: 27 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Tracing/CaptureMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;

namespace Amazon.LambdaPowertools.Tracing
{
/// <summary>
/// Decorator to trace a function execution
/// Creates subsegment named after the method
/// Optionally supports both sync and async method
/// Adds function response as trace metadata using service attribute as metadata namespace
/// </summary>

[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class CaptureMethod : Attribute
{
public CaptureMethod(ITracerOptions options)
{
// not implemented
}

public CaptureMethod(string service = "undefined", bool disabled = false, bool autoPatch = true,
string patchmodules = null)
{
// not implemented
}
}
}
11 changes: 11 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Tracing/ITracer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace Amazon.LambdaPowertools.Tracing
{
public interface ITracer
{
public void Patch(List<string> modules);
public void PutAnnotation(string key, string value);
public void PutMetadata(string key, string value) ;
}
}
27 changes: 27 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Tracing/ITracerOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace Amazon.LambdaPowertools.Tracing
{
public interface ITracerOptions
{
/// <summary>
/// Service: default "service_undefined", env:POWERTOOLS_SERVICE_NAME
/// </summary>
public string Service { get; set; }

/// <summary>
/// Explicitly disable tracing via env var POWERTOOLS_TRACE_DISABLED="true"
/// </summary>
public bool Disabled { get; set; }

/// <summary>
/// If true, it'll use X-Ray to patch all supported libraries at initialization
/// </summary>
public bool AutoPatch { get; set; }

/// <summary>
/// Tuple of specific supported modules by X-Ray that should be patched
/// </summary>
public Tuple<string> PatchModules { get; set; }
}
}
22 changes: 22 additions & 0 deletions libaries/src/Amazon.LambdaPowertools.Tracing/Tracer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;

namespace Amazon.LambdaPowertools.Tracing
{
public class Tracer : ITracer
{
public void Patch(List<string> modules)
{
throw new System.NotImplementedException();
}

public void PutAnnotation(string key, string value)
{
throw new System.NotImplementedException();
}

public void PutMetadata(string key, string value)
{
throw new System.NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions libaries/src/Amazon.LambdaPowertools/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace Amazon.LambdaPowertools
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
10 changes: 10 additions & 0 deletions libaries/tests/Amazon.LambdaPowertools.Logging.Tests/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace Amazon.LambdaPowertools.Logging.Tests
{


public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace Amazon.LambdaPowertools.Metrics.Tests
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Amazon.LambdaPowertools.Tracing\Amazon.LambdaPowertools.Tracing.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;

namespace Amazon.LambdaPowertools.Tracing.Tests
{

public class TestFunction
{
private readonly ITracer _tracer;

public TestFunction()
{
_tracer = new Tracer();
}


[Obsolete]
[CaptureMethod(service: "MyService", disabled:false, autoPatch: false, patchmodules: null)]
private string ConfirmBooking(string bookingId)
{
var response = AddConfirmation(bookingId);

_tracer.PutMetadata("BookingConfirmation", response["requestId"]);
_tracer.PutMetadata("Booking confirmation", JSON);
_tracer.PutMetadata("", "");


return response;
}

private Dictionary<string,string> AddConfirmation(string bookingId)
{
throw new NotImplementedException();
}
}
}