Skip to content
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

chore: V2 update from main #1365

Merged
merged 31 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bd03d76
build(deps): bump aws.sdk.version from 2.20.119 to 2.20.120 (#1349)
dependabot[bot] Aug 7, 2023
c5725d1
build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib (#1350)
dependabot[bot] Aug 7, 2023
28b2f1f
build(deps): bump aws.sdk.version from 2.20.120 to 2.20.121 (#1351)
dependabot[bot] Aug 8, 2023
594b788
build(deps): bump aws.sdk.version from 2.20.121 to 2.20.122 (#1354)
dependabot[bot] Aug 9, 2023
bc71586
build(deps): bump aws.sdk.version from 2.20.122 to 2.20.123 (#1355)
dependabot[bot] Aug 10, 2023
e8cd878
build(deps): bump aws.sdk.version from 2.20.123 to 2.20.124 (#1356)
dependabot[bot] Aug 11, 2023
ae58dd6
build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib (#1357)
dependabot[bot] Aug 14, 2023
ef11a64
docs: Adding CDK example (#1321)
AlexeySoshin Aug 14, 2023
6f05396
build(deps-dev): bump org.yaml:snakeyaml from 2.0 to 2.1 (#1344)
dependabot[bot] Aug 14, 2023
f03832b
build(deps): bump org.apache.maven.plugins:maven-compiler-plugin (#1360)
dependabot[bot] Aug 14, 2023
78e8972
build(deps-dev): bump org.junit.jupiter:junit-jupiter (#1362)
dependabot[bot] Aug 15, 2023
3ebd5cc
build(deps): bump aws.sdk.version from 2.20.124 to 2.20.125 (#1361)
dependabot[bot] Aug 15, 2023
b386ef4
Merge
scottgerring Aug 15, 2023
d282916
Merge
scottgerring Aug 15, 2023
adb2a7e
build(deps): bump org.codehaus.mojo:exec-maven-plugin (#1366)
dependabot[bot] Aug 15, 2023
aa40708
build(deps-dev): bump software.amazon.awscdk:aws-cdk-lib (#1368)
dependabot[bot] Aug 15, 2023
bca90c9
build(deps): bump aws.sdk.version from 2.20.125 to 2.20.126 (#1367)
dependabot[bot] Aug 15, 2023
be284e2
build(deps): bump aws.sdk.version from 2.20.126 to 2.20.127 (#1372)
dependabot[bot] Aug 16, 2023
424f888
build(deps): bump aws.sdk.version from 2.20.109 to 2.20.128 (#1377)
dependabot[bot] Aug 17, 2023
41be012
more main
scottgerring Aug 17, 2023
29f71dd
fix: Roll log4j shade transformer forwards (#1376)
scottgerring Aug 18, 2023
a0ea4c3
build(deps): bump com.amazonaws:aws-lambda-java-core from 1.2.2 to 1.…
dependabot[bot] Aug 18, 2023
e7fb00c
build(deps): bump aws.sdk.version from 2.20.127 to 2.20.129 (#1380)
dependabot[bot] Aug 18, 2023
cfd45bd
chore:Prep release 1.17.0 (#1381)
jeromevdl Aug 21, 2023
7b0af2c
chore: Fix missing version change pieces (#1382)
scottgerring Aug 21, 2023
018e319
We shouldn't deploy CDK (#1383)
scottgerring Aug 21, 2023
1c84795
build(deps): bump aws.sdk.version from 2.20.129 to 2.20.130 (#1386)
dependabot[bot] Aug 21, 2023
99982d6
Fix batch pom (#1385)
scottgerring Aug 21, 2023
b01e3df
Update to snapshot (#1384)
scottgerring Aug 21, 2023
07c31d3
Fix batch logging (#1387)
scottgerring Aug 21, 2023
db278ad
Merge branch 'main' into main-into-v2
scottgerring Aug 22, 2023
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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) fo

## [Unreleased]

## [1.17.0] - 2023-08-21

### Added
* Feat: Add Batch Processor module in (#1317) by @scottgerring
* Feat: Add SNS+SQS large messages module (#1310) by @jeromevdl

### Maintenance
* fix: use default credentials provider for all provided SDK clients in (#1303) by @roamingthings
* Chore: Make request for Logger explicitly for current class in (#1307) by @jreijn
* Chore: checkstyle formater & linter in (#1316) by @jeromevdl
* Chore: Add powertools specific user-agent-suffix to the AWS SDK v2 clients by @eldimi in (#1306)
* Chore: Add 'v2' branch to build workflows to prepare for v2 work in (#1341) by @scottgerring
* Deps: Bump third party dependencies to the latest versions.

### Documentation
* Docs: Add maintainers guide in (#1326) by @scottgerring
* Docs: improve contributing guide in (#1334) by @jeromevdl
* Docs: Improve example documentation in (#1291) by @scottgerring
* Docs: Add discord + sec disclosure links to readme in (#1311) by @scottgerring
* Docs: Add external examples from AWS SAM CLI App Templates in (#1318) by @AlexeySoshin
* Docs: Add CDK example in (#1321) by @AlexeySoshin

## [1.16.1] - 2023-07-19

* Fix: idempotency timeout bug (#1285) by @scottgerring
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ Powertools for AWS Lambda (Java) is available in Maven Central. You can use your
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-tracing</artifactId>
<version>1.16.1</version>
<version>1.17.0</version>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-logging</artifactId>
<version>1.16.1</version>
<version>1.17.0</version>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-metrics</artifactId>
<version>1.16.1</version>
<version>1.17.0</version>
</dependency>
...
</dependencies>
Expand Down
2 changes: 2 additions & 0 deletions examples/.gitignore
scottgerring marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dependency-reduced-pom.xml
.aws-sam
cdk.out
.m2
10 changes: 7 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Each example can be copied from its subdirectory and used independently of the r

## Examples

* [powertools-examples-core](powertools-examples-core) - Demonstrates the core logging, tracing, and metrics modules
* [powertools-examples-core](powertools-examples-core) - Demonstrates the core logging, tracing, and metrics modules with different build tools
* [SAM](./powertools-examples-core/sam)
* [CDK](./powertools-examples-core/cdk)
* [powertools-examples-idempotency](powertools-examples-idempotency) - An idempotent HTTP API
* [powertools-examples-parameters](powertools-examples-parameters) - Uses the parameters module to provide runtime parameters to a function
* [powertools-examples-serialization](powertools-examples-serialization) - Uses the serialization module to serialize and deserialize API Gateway & SQS payloads
Expand Down Expand Up @@ -34,8 +36,8 @@ amongst other things.
To build and deploy an example application for the first time, run the following in your shell:

```bash
# Switch to the directory containing an example for the powertools-core module
$ cd powertools-examples-core
# Switch to the directory containing an example for the powertools-idempotency module
$ cd powertools-examples-idempotency

# Build and deploy the example
$ sam build
Expand All @@ -52,6 +54,8 @@ The first command will build the source of your application. The second command

You can find your API Gateway Endpoint URL in the output values displayed after deployment.

If you're not using SAM, you can look for examples for other tools under [powertools-examples-core](./powertools-examples-core)

### External examples

You can find more examples in the https://github.com/aws/aws-sam-cli-app-templates project:
Expand Down
4 changes: 3 additions & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
</description>

<modules>
<module>powertools-examples-core</module>
<module>powertools-examples-core/sam</module>
<module>powertools-examples-core/cdk/app</module>
<module>powertools-examples-core/cdk/infra</module>
<module>powertools-examples-idempotency</module>
<module>powertools-examples-parameters</module>
<module>powertools-examples-serialization</module>
Expand Down
14 changes: 6 additions & 8 deletions examples/powertools-examples-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip>
<sdk.version>2.20.109</sdk.version>
<sdk.version>2.20.128</sdk.version>
</properties>

<dependencies>
Expand All @@ -37,7 +37,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down Expand Up @@ -107,18 +107,16 @@
</goals>
<configuration>
<transformers>
<transformer
implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer">
</transformer>
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>2.15</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class KinesisBatchHandler implements RequestHandler<KinesisEvent, StreamsEventResponse> {

private final static Logger LOGGER = LogManager.getLogger(org.demo.batch.sqs.SqsBatchHandler.class);
private final static Logger LOGGER = LogManager.getLogger(KinesisBatchHandler.class);
private final BatchMessageHandler<KinesisEvent, StreamsEventResponse> handler;

public KinesisBatchHandler() {
Expand Down
14 changes: 6 additions & 8 deletions examples/powertools-examples-cloudformation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip>
<lambda.core.version>1.2.2</lambda.core.version>
<lambda.core.version>1.2.3</lambda.core.version>
<lambda.events.version>3.11.2</lambda.events.version>
<aws.sdk.version>2.20.119</aws.sdk.version>
<aws.sdk.version>2.20.130</aws.sdk.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -132,18 +132,16 @@
</goals>
<configuration>
<transformers>
<transformer
implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer">
</transformer>
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>2.15</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
scottgerring marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
27 changes: 9 additions & 18 deletions examples/powertools-examples-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ This project demonstrates the Lambda for Powertools Java module - including
[tracing](https://docs.powertools.aws.dev/lambda/java/core/tracing/), and
[metrics](https://docs.powertools.aws.dev/lambda/java/core/metrics/).

It is made up of the following:
We provide examples for the following infrastructure-as-code tools:
* [AWS SAM](sam/)
* [AWS CDK](cdk/)

- [App.java](src/main/java/helloworld/App.java) - Code for the application's Lambda function.
- [events](events) - Invocation events that you can use to invoke the function.
- [AppTests.java](src/test/java/helloworld/AppTest.java) - Unit tests for the application code.
- [template.yaml](template.yaml) - A template that defines the application's AWS resources.
For each of the tools, the example application is the same, and consists of the following files:

## Deploy the sample application
- [App.java](sam/src/main/java/helloworld/App.java) - Code for the application's Lambda function.
- [AppTests.java](sam/src/test/java/helloworld/AppTest.java) - Unit tests for the application code.
- [events](sam/events/event.json) - Invocation events that you can use to invoke the function.

This sample is based on Serverless Application Model (SAM). To deploy it, check out the instructions for getting
started with SAM in [the examples directory](../README.md)
Configuration files and deployment process for each tool are described in corresponding README files.

## Test the application

Expand All @@ -35,13 +35,4 @@ different function calls within the example

Likewise, from the CloudWatch dashboard, under **Metrics**, **all metrics**, you will find the namespaces `Another`
and `ServerlessAirline`. The values in each of these are published by the code in
[App.java](src/main/java/helloworld/App.java).

You can also watch the trace information or log information using the SAM CLI:
```bash
# Tail the logs
sam logs --tail $MY_STACK

# Tail the traces
sam traces --tail
```
[App.java](sam/src/main/java/helloworld/App.java).
36 changes: 36 additions & 0 deletions examples/powertools-examples-core/cdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Powertools for AWS Lambda (Java) - Core Utilities Example with CDK

This project demonstrates the Lambda for Powertools Java module deployed using [Cloud Development Kit](https://aws.amazon.com/cdk/).

For general information on the deployed example itself, you can refer to the parent [README](../README.md)

## Configuration
CDK uses the following project structure:
- [app](./app) - stores the source code of your application, which is similar between all examples
- [infra](./infra) - stores the definition of your infrastructure
- [cdk.json](./infra/cdk.json) - tells the CDK Toolkit how to execute your app
- [CdkApp](./infra/src/main/java/cdk/CdkApp.java) - bootstraps your stack, taking AWS `account` and `region` as input
- [CdkStack](./infra/src/main/java/cdk/CdkStack.java) - defines the Lambda function to be deployed as well as API Gateway for it.

It is a [Maven](https://maven.apache.org/) based project, so you can open this project with any Maven compatible Java IDE to build and run tests.


## Deploy the sample application

The minimum to deploy the app should be
```bash
cdk deploy
```

If you're running CDK for the first time, you'll need to first run the bootstrap command:
```bash
cdk bootstrap
```

## Useful commands

* `mvn package` compile and run tests
* `cdk synth` emits the synthesized CloudFormation template
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk docs` open CDK documentation
Loading
Loading