From 3c60344dccace09c1f775f5d6b205fd03779d6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Wed, 14 Feb 2024 19:32:18 +0100 Subject: [PATCH 01/13] Add cdk csharp pattern --- cdk/c#/.gitignore | 342 ++++++++++++++++++++++ cdk/c#/README.md | 14 + cdk/c#/cdk.json | 61 ++++ cdk/c#/src/C#.sln | 34 +++ cdk/c#/src/C#/C#.csproj | 20 ++ cdk/c#/src/C#/GlobalSuppressions.cs | 1 + cdk/c#/src/C#/Program.cs | 14 + cdk/c#/src/C#/TheLambdaPowerTunerStack.cs | 30 ++ 8 files changed, 516 insertions(+) create mode 100644 cdk/c#/.gitignore create mode 100644 cdk/c#/README.md create mode 100644 cdk/c#/cdk.json create mode 100644 cdk/c#/src/C#.sln create mode 100644 cdk/c#/src/C#/C#.csproj create mode 100644 cdk/c#/src/C#/GlobalSuppressions.cs create mode 100644 cdk/c#/src/C#/Program.cs create mode 100644 cdk/c#/src/C#/TheLambdaPowerTunerStack.cs diff --git a/cdk/c#/.gitignore b/cdk/c#/.gitignore new file mode 100644 index 00000000..a4609e75 --- /dev/null +++ b/cdk/c#/.gitignore @@ -0,0 +1,342 @@ +# CDK asset staging directory +.cdk.staging +cdk.out + +# Created by https://www.gitignore.io/api/csharp + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + + +# End of https://www.gitignore.io/api/csharp \ No newline at end of file diff --git a/cdk/c#/README.md b/cdk/c#/README.md new file mode 100644 index 00000000..f28e4d55 --- /dev/null +++ b/cdk/c#/README.md @@ -0,0 +1,14 @@ +# Welcome to your CDK C# project! + +This is a blank project for CDK development with C#. + +The `cdk.json` file tells the CDK Toolkit how to execute your app. + +It uses the [.NET CLI](https://docs.microsoft.com/dotnet/articles/core/) to compile and execute your project. + +## Useful commands + +* `dotnet build src` compile this app +* `cdk deploy` deploy this stack to your default AWS account/region +* `cdk diff` compare deployed stack with current state +* `cdk synth` emits the synthesized CloudFormation template \ No newline at end of file diff --git a/cdk/c#/cdk.json b/cdk/c#/cdk.json new file mode 100644 index 00000000..de89d864 --- /dev/null +++ b/cdk/c#/cdk.json @@ -0,0 +1,61 @@ +{ + "app": "dotnet run --project src/C#/C#.csproj", + "watch": { + "include": [ + "**" + ], + "exclude": [ + "README.md", + "cdk*.json", + "src/*/obj", + "src/*/bin", + "src/*.sln", + "src/*/GlobalSuppressions.cs", + "src/*/*.csproj" + ] + }, + "context": { + "@aws-cdk/aws-lambda:recognizeLayerVersion": true, + "@aws-cdk/core:checkSecretUsage": true, + "@aws-cdk/core:target-partitions": [ + "aws", + "aws-cn" + ], + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, + "@aws-cdk/aws-iam:minimizePolicies": true, + "@aws-cdk/core:validateSnapshotRemovalPolicy": true, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, + "@aws-cdk/core:enablePartitionLiterals": true, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, + "@aws-cdk/aws-iam:standardizedServicePrincipals": true, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, + "@aws-cdk/aws-route53-patters:useCertificate": true, + "@aws-cdk/customresources:installLatestAwsSdkDefault": false, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, + "@aws-cdk/aws-redshift:columnId": true, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, + "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true, + "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, + "@aws-cdk/aws-kms:aliasNameRef": true, + "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, + "@aws-cdk/core:includePrefixInUniqueNameGeneration": true, + "@aws-cdk/aws-efs:denyAnonymousAccess": true, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true, + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true, + "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true, + "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, + "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, + "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true + } +} diff --git a/cdk/c#/src/C#.sln b/cdk/c#/src/C#.sln new file mode 100644 index 00000000..57cef855 --- /dev/null +++ b/cdk/c#/src/C#.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C#", "C#\C#.csproj", "{F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.Build.0 = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.Build.0 = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/cdk/c#/src/C#/C#.csproj b/cdk/c#/src/C#/C#.csproj new file mode 100644 index 00000000..1993b9be --- /dev/null +++ b/cdk/c#/src/C#/C#.csproj @@ -0,0 +1,20 @@ + + + + Exe + net6.0 + + Major + + + + + + + + + + + diff --git a/cdk/c#/src/C#/GlobalSuppressions.cs b/cdk/c#/src/C#/GlobalSuppressions.cs new file mode 100644 index 00000000..26233fcb --- /dev/null +++ b/cdk/c#/src/C#/GlobalSuppressions.cs @@ -0,0 +1 @@ +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'", Justification = "Constructs add themselves to the scope in which they are created")] diff --git a/cdk/c#/src/C#/Program.cs b/cdk/c#/src/C#/Program.cs new file mode 100644 index 00000000..50f098c4 --- /dev/null +++ b/cdk/c#/src/C#/Program.cs @@ -0,0 +1,14 @@ +using Amazon.CDK; + +namespace TheLambdaPowerTuner +{ + sealed class Program + { + public static void Main(string[] args) + { + var app = new App(); + new TheLambdaPowerTunerStack(app, "TheLambdaPowerTunerStack", new StackProps()); + app.Synth(); + } + } +} diff --git a/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs b/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs new file mode 100644 index 00000000..e492b801 --- /dev/null +++ b/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Amazon.CDK; +using Amazon.CDK.AWS.SAM; +using Constructs; + +namespace TheLambdaPowerTuner +{ + public class TheLambdaPowerTunerStack : Stack + { + internal TheLambdaPowerTunerStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props) + { + const string powerValues = "128,256,512,1024,1536,3008"; + const string lambdaResource = "*"; + + new CfnApplication(this, "SAR", new CfnApplicationProps + { + Location = new CfnApplication.ApplicationLocationProperty { + ApplicationId = "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning", + // TODO change semantic version to latest + SemanticVersion = "4.2.0" + }, + Parameters = new Dictionary { + { "lambdaResource", lambdaResource}, + { "PowerValues", powerValues } + } + } + ); + } + } +} \ No newline at end of file From 378659e7ab1f94968095670e263f1187a1a41c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 22 Feb 2024 17:33:19 +0100 Subject: [PATCH 02/13] Folder structure changes and added tests --- cdk/c#/.gitignore | 342 ---------------------- cdk/c#/README.md | 14 - cdk/c#/cdk.json | 61 ---- cdk/c#/src/C#.sln | 34 --- cdk/c#/src/C#/C#.csproj | 20 -- cdk/c#/src/C#/GlobalSuppressions.cs | 1 - cdk/c#/src/C#/Program.cs | 14 - cdk/c#/src/C#/TheLambdaPowerTunerStack.cs | 30 -- 8 files changed, 516 deletions(-) delete mode 100644 cdk/c#/.gitignore delete mode 100644 cdk/c#/README.md delete mode 100644 cdk/c#/cdk.json delete mode 100644 cdk/c#/src/C#.sln delete mode 100644 cdk/c#/src/C#/C#.csproj delete mode 100644 cdk/c#/src/C#/GlobalSuppressions.cs delete mode 100644 cdk/c#/src/C#/Program.cs delete mode 100644 cdk/c#/src/C#/TheLambdaPowerTunerStack.cs diff --git a/cdk/c#/.gitignore b/cdk/c#/.gitignore deleted file mode 100644 index a4609e75..00000000 --- a/cdk/c#/.gitignore +++ /dev/null @@ -1,342 +0,0 @@ -# CDK asset staging directory -.cdk.staging -cdk.out - -# Created by https://www.gitignore.io/api/csharp - -### Csharp ### -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - - -# End of https://www.gitignore.io/api/csharp \ No newline at end of file diff --git a/cdk/c#/README.md b/cdk/c#/README.md deleted file mode 100644 index f28e4d55..00000000 --- a/cdk/c#/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Welcome to your CDK C# project! - -This is a blank project for CDK development with C#. - -The `cdk.json` file tells the CDK Toolkit how to execute your app. - -It uses the [.NET CLI](https://docs.microsoft.com/dotnet/articles/core/) to compile and execute your project. - -## Useful commands - -* `dotnet build src` compile this app -* `cdk deploy` deploy this stack to your default AWS account/region -* `cdk diff` compare deployed stack with current state -* `cdk synth` emits the synthesized CloudFormation template \ No newline at end of file diff --git a/cdk/c#/cdk.json b/cdk/c#/cdk.json deleted file mode 100644 index de89d864..00000000 --- a/cdk/c#/cdk.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": "dotnet run --project src/C#/C#.csproj", - "watch": { - "include": [ - "**" - ], - "exclude": [ - "README.md", - "cdk*.json", - "src/*/obj", - "src/*/bin", - "src/*.sln", - "src/*/GlobalSuppressions.cs", - "src/*/*.csproj" - ] - }, - "context": { - "@aws-cdk/aws-lambda:recognizeLayerVersion": true, - "@aws-cdk/core:checkSecretUsage": true, - "@aws-cdk/core:target-partitions": [ - "aws", - "aws-cn" - ], - "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, - "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, - "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, - "@aws-cdk/aws-iam:minimizePolicies": true, - "@aws-cdk/core:validateSnapshotRemovalPolicy": true, - "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, - "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, - "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, - "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, - "@aws-cdk/core:enablePartitionLiterals": true, - "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, - "@aws-cdk/aws-iam:standardizedServicePrincipals": true, - "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, - "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, - "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, - "@aws-cdk/aws-route53-patters:useCertificate": true, - "@aws-cdk/customresources:installLatestAwsSdkDefault": false, - "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, - "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, - "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, - "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, - "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, - "@aws-cdk/aws-redshift:columnId": true, - "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, - "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true, - "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, - "@aws-cdk/aws-kms:aliasNameRef": true, - "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, - "@aws-cdk/core:includePrefixInUniqueNameGeneration": true, - "@aws-cdk/aws-efs:denyAnonymousAccess": true, - "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true, - "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true, - "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true, - "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, - "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, - "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true - } -} diff --git a/cdk/c#/src/C#.sln b/cdk/c#/src/C#.sln deleted file mode 100644 index 57cef855..00000000 --- a/cdk/c#/src/C#.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C#", "C#\C#.csproj", "{F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.ActiveCfg = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.Build.0 = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.ActiveCfg = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.Build.0 = Debug|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.Build.0 = Release|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.ActiveCfg = Release|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.Build.0 = Release|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.ActiveCfg = Release|Any CPU - {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/cdk/c#/src/C#/C#.csproj b/cdk/c#/src/C#/C#.csproj deleted file mode 100644 index 1993b9be..00000000 --- a/cdk/c#/src/C#/C#.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Exe - net6.0 - - Major - - - - - - - - - - - diff --git a/cdk/c#/src/C#/GlobalSuppressions.cs b/cdk/c#/src/C#/GlobalSuppressions.cs deleted file mode 100644 index 26233fcb..00000000 --- a/cdk/c#/src/C#/GlobalSuppressions.cs +++ /dev/null @@ -1 +0,0 @@ -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'", Justification = "Constructs add themselves to the scope in which they are created")] diff --git a/cdk/c#/src/C#/Program.cs b/cdk/c#/src/C#/Program.cs deleted file mode 100644 index 50f098c4..00000000 --- a/cdk/c#/src/C#/Program.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Amazon.CDK; - -namespace TheLambdaPowerTuner -{ - sealed class Program - { - public static void Main(string[] args) - { - var app = new App(); - new TheLambdaPowerTunerStack(app, "TheLambdaPowerTunerStack", new StackProps()); - app.Synth(); - } - } -} diff --git a/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs b/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs deleted file mode 100644 index e492b801..00000000 --- a/cdk/c#/src/C#/TheLambdaPowerTunerStack.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using Amazon.CDK; -using Amazon.CDK.AWS.SAM; -using Constructs; - -namespace TheLambdaPowerTuner -{ - public class TheLambdaPowerTunerStack : Stack - { - internal TheLambdaPowerTunerStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props) - { - const string powerValues = "128,256,512,1024,1536,3008"; - const string lambdaResource = "*"; - - new CfnApplication(this, "SAR", new CfnApplicationProps - { - Location = new CfnApplication.ApplicationLocationProperty { - ApplicationId = "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning", - // TODO change semantic version to latest - SemanticVersion = "4.2.0" - }, - Parameters = new Dictionary { - { "lambdaResource", lambdaResource}, - { "PowerValues", powerValues } - } - } - ); - } - } -} \ No newline at end of file From f6b4076a0a4a6fe25f9709464782bef1f68370dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 22 Feb 2024 17:33:19 +0100 Subject: [PATCH 03/13] Folder structure changes and added tests --- cdk/csharp/.gitignore | 342 ++++++++++++++++++ cdk/csharp/README.md | 28 ++ cdk/csharp/cdk.json | 61 ++++ cdk/csharp/src/Cdk.sln | 48 +++ cdk/csharp/src/src/Cdk/Cdk.csproj | 25 ++ cdk/csharp/src/src/Cdk/GlobalSuppressions.cs | 1 + cdk/csharp/src/src/Cdk/Program.cs | 14 + .../src/src/Cdk/TheLambdaPowerTunerStack.cs | 39 ++ .../src/tests/Cdk.Tests/Cdk.Tests.csproj | 23 ++ .../src/tests/Cdk.Tests/GlobalUsings.cs | 1 + .../Cdk.Tests/TheLambdaPowerTunerStackTest.cs | 36 ++ 11 files changed, 618 insertions(+) create mode 100644 cdk/csharp/.gitignore create mode 100644 cdk/csharp/README.md create mode 100644 cdk/csharp/cdk.json create mode 100644 cdk/csharp/src/Cdk.sln create mode 100644 cdk/csharp/src/src/Cdk/Cdk.csproj create mode 100644 cdk/csharp/src/src/Cdk/GlobalSuppressions.cs create mode 100644 cdk/csharp/src/src/Cdk/Program.cs create mode 100644 cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs create mode 100644 cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj create mode 100644 cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs create mode 100644 cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs diff --git a/cdk/csharp/.gitignore b/cdk/csharp/.gitignore new file mode 100644 index 00000000..a4609e75 --- /dev/null +++ b/cdk/csharp/.gitignore @@ -0,0 +1,342 @@ +# CDK asset staging directory +.cdk.staging +cdk.out + +# Created by https://www.gitignore.io/api/csharp + +### Csharp ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + + +# End of https://www.gitignore.io/api/csharp \ No newline at end of file diff --git a/cdk/csharp/README.md b/cdk/csharp/README.md new file mode 100644 index 00000000..fc4f582d --- /dev/null +++ b/cdk/csharp/README.md @@ -0,0 +1,28 @@ +# How to deploy the AWS Lambda Power Tuner tool using the CDK for C# + +This CDK project deploys the *AWS Lambda Power Tuner* tool. + +You can use the project as a standalone or reuse it within your own CDK projects. + +## Prerequisites + +- [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) +- [.NET 8.0 or later](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) + +See also the general [prerequisites for CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) projects. + +## Deployment + +``` +cd cdk/csharp +dotnet build src +cdk deploy +``` + +## Useful commands + +* `dotnet build src` compile this app +* `dotnet test src` test this app +* `cdk deploy` deploy this stack to your default AWS account/region +* `cdk diff` compare deployed stack with current state +* `cdk synth` emits the synthesized CloudFormation template diff --git a/cdk/csharp/cdk.json b/cdk/csharp/cdk.json new file mode 100644 index 00000000..8af6ce12 --- /dev/null +++ b/cdk/csharp/cdk.json @@ -0,0 +1,61 @@ +{ + "app": "dotnet run --project src/src/Cdk/Cdk.csproj", + "watch": { + "include": [ + "**" + ], + "exclude": [ + "README.md", + "cdk*.json", + "src/*/obj", + "src/*/bin", + "src/*.sln", + "src/*/GlobalSuppressions.cs", + "src/*/*.csproj" + ] + }, + "context": { + "@aws-cdk/aws-lambda:recognizeLayerVersion": true, + "@aws-cdk/core:checkSecretUsage": true, + "@aws-cdk/core:target-partitions": [ + "aws", + "aws-cn" + ], + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, + "@aws-cdk/aws-iam:minimizePolicies": true, + "@aws-cdk/core:validateSnapshotRemovalPolicy": true, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, + "@aws-cdk/core:enablePartitionLiterals": true, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, + "@aws-cdk/aws-iam:standardizedServicePrincipals": true, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, + "@aws-cdk/aws-route53-patters:useCertificate": true, + "@aws-cdk/customresources:installLatestAwsSdkDefault": false, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, + "@aws-cdk/aws-redshift:columnId": true, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, + "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true, + "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, + "@aws-cdk/aws-kms:aliasNameRef": true, + "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, + "@aws-cdk/core:includePrefixInUniqueNameGeneration": true, + "@aws-cdk/aws-efs:denyAnonymousAccess": true, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true, + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true, + "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true, + "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true, + "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true, + "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true + } +} diff --git a/cdk/csharp/src/Cdk.sln b/cdk/csharp/src/Cdk.sln new file mode 100644 index 00000000..f7797402 --- /dev/null +++ b/cdk/csharp/src/Cdk.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cdk", "src\Cdk\Cdk.csproj", "{F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheLambdaPowerTunerStackTest", "tests\Cdk.Tests\Cdk.Tests.csproj", "{C97C3EF9-2E85-4625-B512-6D43FB272F8C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x64.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.ActiveCfg = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Debug|x86.Build.0 = Debug|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|Any CPU.Build.0 = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x64.Build.0 = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.ActiveCfg = Release|Any CPU + {F90E7C82-F4CE-4CF0-8B3C-3BBEE813389A}.Release|x86.Build.0 = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|x64.ActiveCfg = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|x64.Build.0 = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|x86.ActiveCfg = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Debug|x86.Build.0 = Debug|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|Any CPU.Build.0 = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|x64.ActiveCfg = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|x64.Build.0 = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|x86.ActiveCfg = Release|Any CPU + {C97C3EF9-2E85-4625-B512-6D43FB272F8C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/cdk/csharp/src/src/Cdk/Cdk.csproj b/cdk/csharp/src/src/Cdk/Cdk.csproj new file mode 100644 index 00000000..16e9fa62 --- /dev/null +++ b/cdk/csharp/src/src/Cdk/Cdk.csproj @@ -0,0 +1,25 @@ + + + + Exe + net8.0 + + Major + C# + + + + + + + + + + <_Parameter1>$(MSBuildProjectName).Tests + + + + + diff --git a/cdk/csharp/src/src/Cdk/GlobalSuppressions.cs b/cdk/csharp/src/src/Cdk/GlobalSuppressions.cs new file mode 100644 index 00000000..26233fcb --- /dev/null +++ b/cdk/csharp/src/src/Cdk/GlobalSuppressions.cs @@ -0,0 +1 @@ +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'", Justification = "Constructs add themselves to the scope in which they are created")] diff --git a/cdk/csharp/src/src/Cdk/Program.cs b/cdk/csharp/src/src/Cdk/Program.cs new file mode 100644 index 00000000..05350ac5 --- /dev/null +++ b/cdk/csharp/src/src/Cdk/Program.cs @@ -0,0 +1,14 @@ +using Amazon.CDK; + +namespace TheLambdaPowerTunerStack +{ + sealed class Program + { + public static void Main(string[] args) + { + var app = new App(); + new TheLambdaPowerTunerStack(app, "TheLambdaPowerTunerStack", new StackProps()); + app.Synth(); + } + } +} diff --git a/cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs b/cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs new file mode 100644 index 00000000..e78c61f0 --- /dev/null +++ b/cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using Amazon.CDK; +using Amazon.CDK.AWS.SAM; +using Constructs; + +namespace TheLambdaPowerTunerStack +{ + public class TheLambdaPowerTunerStack : Stack + { + internal TheLambdaPowerTunerStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props) + { + var stateMachineConfiguration = new Dictionary + { + { "lambdaResource", "*" }, + { "PowerValues", "128,256,512,1024,1536,3008" }, + { "visualizationURL", "https://lambda-power-tuning.show/" }, + { "totalExecutionTimeout", "300" }, + { "payloadS3Key", "*" }, + { "logGroupRetentionInDays", "7" }, + { "stateMachineNamePrefix", "powerTuningStateMachine" }, + // { "permissionsBoundary", "" }, + // { "payloadS3Bucket", "" }, + // { "layerSdkName", "" }, + // { "securityGroupIds", "" }, + // { "subnetIds", "" }, + }; + + new CfnApplication(this, "SAR", new CfnApplicationProps + { + Location = new CfnApplication.ApplicationLocationProperty { + ApplicationId = "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning", + SemanticVersion = "4.3.0" + }, + Parameters = stateMachineConfiguration + } + ); + } + } +} \ No newline at end of file diff --git a/cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj b/cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj new file mode 100644 index 00000000..d86e8c6a --- /dev/null +++ b/cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj @@ -0,0 +1,23 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + + + + + + + + diff --git a/cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs b/cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs new file mode 100644 index 00000000..ab67c7ea --- /dev/null +++ b/cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Microsoft.VisualStudio.TestTools.UnitTesting; \ No newline at end of file diff --git a/cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs b/cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs new file mode 100644 index 00000000..c010a54e --- /dev/null +++ b/cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs @@ -0,0 +1,36 @@ +using Amazon.CDK; +using Amazon.CDK.Assertions; + +using ObjectDict = System.Collections.Generic.Dictionary; + +namespace TheLambdaPowerTunerStack.Tests +{ + [TestClass] + public class TheLambdaPowerTunerStackTest + { + private Template? _template; + + [TestInitialize()] + public void Startup() + { + var app = new App(); + var stack = new TheLambdaPowerTunerStack(app, "TheLambdaPowerTunerStack", new StackProps()); + _template = Template.FromStack(stack); + } + + [TestMethod] + public void TestSar() + { + _template?.HasResourceProperties("AWS::Serverless::Application", new ObjectDict + { + { "Location" , new ObjectDict + { + { "ApplicationId", "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning" }, + { "SemanticVersion", "4.3.0" } + } + } + } + ); + } + } +} \ No newline at end of file From 611e36ff54786a88f63859b2a2660211ae6be3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 11:10:59 +0100 Subject: [PATCH 04/13] Folder restructuring --- cdk/csharp/{src => }/Cdk.sln | 0 cdk/csharp/README.md | 6 +++--- cdk/csharp/cdk.json | 2 +- cdk/csharp/src/{src => }/Cdk/Cdk.csproj | 0 cdk/csharp/src/{src => }/Cdk/GlobalSuppressions.cs | 0 cdk/csharp/src/{src => }/Cdk/Program.cs | 0 cdk/csharp/src/{src => }/Cdk/TheLambdaPowerTunerStack.cs | 0 cdk/csharp/{src => }/tests/Cdk.Tests/Cdk.Tests.csproj | 0 cdk/csharp/{src => }/tests/Cdk.Tests/GlobalUsings.cs | 0 .../tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs | 0 10 files changed, 4 insertions(+), 4 deletions(-) rename cdk/csharp/{src => }/Cdk.sln (100%) rename cdk/csharp/src/{src => }/Cdk/Cdk.csproj (100%) rename cdk/csharp/src/{src => }/Cdk/GlobalSuppressions.cs (100%) rename cdk/csharp/src/{src => }/Cdk/Program.cs (100%) rename cdk/csharp/src/{src => }/Cdk/TheLambdaPowerTunerStack.cs (100%) rename cdk/csharp/{src => }/tests/Cdk.Tests/Cdk.Tests.csproj (100%) rename cdk/csharp/{src => }/tests/Cdk.Tests/GlobalUsings.cs (100%) rename cdk/csharp/{src => }/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs (100%) diff --git a/cdk/csharp/src/Cdk.sln b/cdk/csharp/Cdk.sln similarity index 100% rename from cdk/csharp/src/Cdk.sln rename to cdk/csharp/Cdk.sln diff --git a/cdk/csharp/README.md b/cdk/csharp/README.md index fc4f582d..ec82aa30 100644 --- a/cdk/csharp/README.md +++ b/cdk/csharp/README.md @@ -15,14 +15,14 @@ See also the general [prerequisites for CDK](https://docs.aws.amazon.com/cdk/v2/ ``` cd cdk/csharp -dotnet build src +dotnet build cdk deploy ``` ## Useful commands -* `dotnet build src` compile this app -* `dotnet test src` test this app +* `dotnet build` compile this app +* `dotnet test` test this app * `cdk deploy` deploy this stack to your default AWS account/region * `cdk diff` compare deployed stack with current state * `cdk synth` emits the synthesized CloudFormation template diff --git a/cdk/csharp/cdk.json b/cdk/csharp/cdk.json index 8af6ce12..89d85475 100644 --- a/cdk/csharp/cdk.json +++ b/cdk/csharp/cdk.json @@ -1,5 +1,5 @@ { - "app": "dotnet run --project src/src/Cdk/Cdk.csproj", + "app": "dotnet run --project src/Cdk/Cdk.csproj", "watch": { "include": [ "**" diff --git a/cdk/csharp/src/src/Cdk/Cdk.csproj b/cdk/csharp/src/Cdk/Cdk.csproj similarity index 100% rename from cdk/csharp/src/src/Cdk/Cdk.csproj rename to cdk/csharp/src/Cdk/Cdk.csproj diff --git a/cdk/csharp/src/src/Cdk/GlobalSuppressions.cs b/cdk/csharp/src/Cdk/GlobalSuppressions.cs similarity index 100% rename from cdk/csharp/src/src/Cdk/GlobalSuppressions.cs rename to cdk/csharp/src/Cdk/GlobalSuppressions.cs diff --git a/cdk/csharp/src/src/Cdk/Program.cs b/cdk/csharp/src/Cdk/Program.cs similarity index 100% rename from cdk/csharp/src/src/Cdk/Program.cs rename to cdk/csharp/src/Cdk/Program.cs diff --git a/cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs b/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs similarity index 100% rename from cdk/csharp/src/src/Cdk/TheLambdaPowerTunerStack.cs rename to cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs diff --git a/cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj b/cdk/csharp/tests/Cdk.Tests/Cdk.Tests.csproj similarity index 100% rename from cdk/csharp/src/tests/Cdk.Tests/Cdk.Tests.csproj rename to cdk/csharp/tests/Cdk.Tests/Cdk.Tests.csproj diff --git a/cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs b/cdk/csharp/tests/Cdk.Tests/GlobalUsings.cs similarity index 100% rename from cdk/csharp/src/tests/Cdk.Tests/GlobalUsings.cs rename to cdk/csharp/tests/Cdk.Tests/GlobalUsings.cs diff --git a/cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs b/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs similarity index 100% rename from cdk/csharp/src/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs rename to cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs From cca5ee4019e588e4c2d9efaf04a12cdc3162bd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 12:04:37 +0100 Subject: [PATCH 05/13] Updated semantic version --- cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs b/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs index e78c61f0..d1289362 100644 --- a/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs +++ b/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs @@ -29,7 +29,7 @@ internal TheLambdaPowerTunerStack(Construct scope, string id, IStackProps props { Location = new CfnApplication.ApplicationLocationProperty { ApplicationId = "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning", - SemanticVersion = "4.3.0" + SemanticVersion = "4.3.4" }, Parameters = stateMachineConfiguration } From f1c4c944f897f41aaa2fb76ee83c882ee7baf5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 12:04:59 +0100 Subject: [PATCH 06/13] cdk commands will now automatically build the app --- cdk/csharp/cdk.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdk/csharp/cdk.json b/cdk/csharp/cdk.json index 89d85475..87130966 100644 --- a/cdk/csharp/cdk.json +++ b/cdk/csharp/cdk.json @@ -1,5 +1,5 @@ { - "app": "dotnet run --project src/Cdk/Cdk.csproj", + "app": "dotnet build && dotnet run --project src/Cdk/Cdk.csproj", "watch": { "include": [ "**" From bbefb66ad2baff81fd17070eedd560ec31bd56d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 12:05:25 +0100 Subject: [PATCH 07/13] Create generic CDK README and updated C# specific one --- cdk/README.md | 33 +++++++++++++++++++ cdk/csharp/README.md | 21 +++--------- .../Cdk.Tests/TheLambdaPowerTunerStackTest.cs | 2 +- 3 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 cdk/README.md diff --git a/cdk/README.md b/cdk/README.md new file mode 100644 index 00000000..6442dcd7 --- /dev/null +++ b/cdk/README.md @@ -0,0 +1,33 @@ +# Deploy the AWS Lambda Power Tuner tool using the CDK + +Here you find various CDK projects to deploy the *AWS Lambda Power Tuner* tool using your preferred programming language. + +Currently we support + +- [TypeScript](typescript/README.md) +- [C#](csharp/README.md) + +You can use these projects as a standalone or reuse it within your own CDK projects. + +## Prerequisites + +- [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) +- [General prerequisites for CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) + +Check also the langauge specific requirements in the respective README. + +## Useful commands + +Run these commands from the project folders: + +* `cdk deploy` deploy this stack to your default AWS account/region +* `cdk diff` compare deployed stack with current state +* `cdk synth` emits the synthesized CloudFormation template + +## Deployment + +``` +cd cdk/csharp +dotnet build +cdk deploy +``` diff --git a/cdk/csharp/README.md b/cdk/csharp/README.md index ec82aa30..7fae0dd5 100644 --- a/cdk/csharp/README.md +++ b/cdk/csharp/README.md @@ -1,28 +1,15 @@ # How to deploy the AWS Lambda Power Tuner tool using the CDK for C# -This CDK project deploys the *AWS Lambda Power Tuner* tool. +This CDK project deploys the *AWS Lambda Power Tuner* tool using C#. You can use the project as a standalone or reuse it within your own CDK projects. -## Prerequisites +## Language specific prerequisites -- [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_install) - [.NET 8.0 or later](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) +- [Requirements for CDK with C#](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-csharp.html#csharp-prerequisites) -See also the general [prerequisites for CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) projects. - -## Deployment - -``` -cd cdk/csharp -dotnet build -cdk deploy -``` - -## Useful commands +## Building and testing the app * `dotnet build` compile this app * `dotnet test` test this app -* `cdk deploy` deploy this stack to your default AWS account/region -* `cdk diff` compare deployed stack with current state -* `cdk synth` emits the synthesized CloudFormation template diff --git a/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs b/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs index c010a54e..2e00025b 100644 --- a/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs +++ b/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs @@ -26,7 +26,7 @@ public void TestSar() { "Location" , new ObjectDict { { "ApplicationId", "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning" }, - { "SemanticVersion", "4.3.0" } + { "SemanticVersion", "4.3.4" } } } } From 18f07a8b0ef0d9e1412136217f62ba05e0693d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 12:09:35 +0100 Subject: [PATCH 08/13] Commented out default values --- cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs b/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs index d1289362..bec030d3 100644 --- a/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs +++ b/cdk/csharp/src/Cdk/TheLambdaPowerTunerStack.cs @@ -11,13 +11,13 @@ internal TheLambdaPowerTunerStack(Construct scope, string id, IStackProps props { var stateMachineConfiguration = new Dictionary { - { "lambdaResource", "*" }, - { "PowerValues", "128,256,512,1024,1536,3008" }, - { "visualizationURL", "https://lambda-power-tuning.show/" }, - { "totalExecutionTimeout", "300" }, - { "payloadS3Key", "*" }, - { "logGroupRetentionInDays", "7" }, - { "stateMachineNamePrefix", "powerTuningStateMachine" }, + // { "lambdaResource", "*" }, + // { "PowerValues", "128,256,512,1024,1536,3008" }, + // { "visualizationURL", "https://lambda-power-tuning.show/" }, + // { "totalExecutionTimeout", "300" }, + // { "payloadS3Key", "*" }, + // { "logGroupRetentionInDays", "7" }, + // { "stateMachineNamePrefix", "powerTuningStateMachine" }, // { "permissionsBoundary", "" }, // { "payloadS3Bucket", "" }, // { "layerSdkName", "" }, From fa8557319e7fc0d385d5be37fa6d5bcd5df2ed67 Mon Sep 17 00:00:00 2001 From: Alex Casalboni Date: Thu, 29 Feb 2024 16:38:39 +0100 Subject: [PATCH 09/13] Update cdk/csharp README.md --- cdk/csharp/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cdk/csharp/README.md b/cdk/csharp/README.md index 7fae0dd5..297b0619 100644 --- a/cdk/csharp/README.md +++ b/cdk/csharp/README.md @@ -1,9 +1,15 @@ -# How to deploy the AWS Lambda Power Tuner tool using the CDK for C# +# How to deploy AWS Lambda Power Tuning using the CDK for C# -This CDK project deploys the *AWS Lambda Power Tuner* tool using C#. +This CDK project deploys *AWS Lambda Power Tuning* using C#. You can use the project as a standalone or reuse it within your own CDK projects. + +## CDK Prerequisites + +See [here](../README.md). + + ## Language specific prerequisites - [.NET 8.0 or later](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) From 4a2a5489fe036762260a3ad499df4f73396be293 Mon Sep 17 00:00:00 2001 From: Alex Casalboni Date: Thu, 29 Feb 2024 16:56:35 +0100 Subject: [PATCH 10/13] Update cdk/README.md --- cdk/README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cdk/README.md b/cdk/README.md index 6442dcd7..77ab17f0 100644 --- a/cdk/README.md +++ b/cdk/README.md @@ -20,14 +20,7 @@ Check also the langauge specific requirements in the respective README. Run these commands from the project folders: +* `cdk bootstrap` bootstrap one or more environments * `cdk deploy` deploy this stack to your default AWS account/region * `cdk diff` compare deployed stack with current state * `cdk synth` emits the synthesized CloudFormation template - -## Deployment - -``` -cd cdk/csharp -dotnet build -cdk deploy -``` From bdb38d91ecd22057a40c287c5f28df9d4ad6927a Mon Sep 17 00:00:00 2001 From: Alex Casalboni Date: Thu, 29 Feb 2024 16:58:02 +0100 Subject: [PATCH 11/13] Update cdk/csharp/README.md --- cdk/csharp/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cdk/csharp/README.md b/cdk/csharp/README.md index 297b0619..ade6b987 100644 --- a/cdk/csharp/README.md +++ b/cdk/csharp/README.md @@ -15,7 +15,8 @@ See [here](../README.md). - [.NET 8.0 or later](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html#getting_started_prerequisites) - [Requirements for CDK with C#](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-csharp.html#csharp-prerequisites) -## Building and testing the app +## Building, testing, and deploying the app * `dotnet build` compile this app * `dotnet test` test this app +* `cdk deploy` deploy this app From a672f58d994c9c07e130b5c57bdeb0f29217ce8f Mon Sep 17 00:00:00 2001 From: Alex Casalboni Date: Thu, 29 Feb 2024 17:27:36 +0100 Subject: [PATCH 12/13] Update cdk/README.md --- cdk/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cdk/README.md b/cdk/README.md index 77ab17f0..e015fe12 100644 --- a/cdk/README.md +++ b/cdk/README.md @@ -1,8 +1,8 @@ -# Deploy the AWS Lambda Power Tuner tool using the CDK +# Deploy AWS Lambda Power Tuning using the CDK -Here you find various CDK projects to deploy the *AWS Lambda Power Tuner* tool using your preferred programming language. +Here you find various CDK projects to deploy *AWS Lambda Power Tuning* using your preferred programming language. -Currently we support +Currently we support: - [TypeScript](typescript/README.md) - [C#](csharp/README.md) From 2d8810f2c2fce2743896b5a5a4ba1728956576c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Stoll?= Date: Thu, 29 Feb 2024 17:50:28 +0100 Subject: [PATCH 13/13] remove semantic version from cdk contruct tests --- cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs b/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs index 2e00025b..cf561b5e 100644 --- a/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs +++ b/cdk/csharp/tests/Cdk.Tests/TheLambdaPowerTunerStackTest.cs @@ -26,7 +26,6 @@ public void TestSar() { "Location" , new ObjectDict { { "ApplicationId", "arn:aws:serverlessrepo:us-east-1:451282441545:applications/aws-lambda-power-tuning" }, - { "SemanticVersion", "4.3.4" } } } }