10000 fix(v2): Add default transformation manager in params module by ritigupt · Pull Request #1546 · aws-powertools/powertools-lambda-java · GitHub
[go: up one dir, main page]

Skip to content

fix(v2): Add default transformation manager in params module #1546

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

Closed
Closed
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
21 changes: 0 additions & 21 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,12 @@ jobs:
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
working-directory: examples/powertools-examples-core/kotlin
run: ./gradlew build
- name: Setup Terraform
if: ${{ matrix.java == '11' }}
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 #v2.0.3
- name: Setup AWS credentials
if: ${{ matrix.java == '11' }}
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}
- name: Terraform validate
working-directory: examples/powertools-examples-core/terraform
if: ${{ matrix.java == '11' }}
run: |
terraform -version
terraform init -backend=false
terraform validate
terraform plan
- name: Setup Terraform lint
if: ${{ matrix.java == '11' }}
uses: terraform-linters/setup-tflint@a5a1af8c6551fb10c53f1cd4ba62359f1973746f # v3.1.1
- name: Terraform lint
working-directory: examples/powertools-examples-core/terraform
if: ${{ matrix.java == '11' }}
run: |
tflint --version
tflint --init
tflint -f compact
- name: Upload coverage to Codecov
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
if: ${{ matrix.java == '11' }} # publish results once
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/pr_iac_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Validate IaC

on:
push:
branches:
- main
- v2
pull_request:
branches:
- main
- v2
paths:
- 'examples/**'
jobs:
linter:
runs-on: ubuntu-latest
strategy:
matrix:
project: ["sam", "gradle", "kotlin"]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup java JDK
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with:
distribution: 'corretto'
java-version: 11
- name: Build Project
working-directory: .
run: |
mvn install -DskipTests
- name: Run SAM validator to check syntax of IaC templates - Java
working-directory: examples/powertools-examples-core/${{ matrix.project }}
run: |
sam build
sam validate --lint
- name: Setup Terraform
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 #v2.0.3
- name: Run Terraform validator to check syntax of IaC templates and produce a plan of changes
working-directory: examples/powertools-examples-core/terraform
run: |
mvn install
terraform -version
terraform init -backend=false
terraform validate
- name: Setup Terraform lint
uses: terraform-linters/setup-tflint@a5a1af8c6551fb10c53f1cd4ba62359f1973746f # v3.1.1
- name: Run Terraform lint to check for best practices, errors, deprecated syntax etc.
working-directory: examples/powertools-examples-core/terraform
run: |
tflint --version
tflint --init
tflint -f compact
3 changes: 0 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,6 @@ Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj
| `11-17` | `1.9.20.1` |
| `21` | `1.9.21` |

_Note: 1.9.21 is not yet available and Java 21 not yet officially supported by aspectj, but you can already use the `1.9.21.M1`_


## Environment variables

!!! info
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,43 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import java.nio.charset.StandardCharsets;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import software.amazon.lambda.powertools.logging.Logging;
import software.amazon.lambda.powertools.metrics.Metrics;

import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class AppStream implements RequestStreamHandler {
private static final ObjectMapper mapper = new ObjectMapper();
private final static Logger log = LogManager.getLogger(AppStream.class);

@Override
@Logging(logEvent = true)
@Metrics(namespace = "ServerlessAirline", service = "payment", captureColdStart = true)
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
Map map = mapper.readValue(input, Map.class);
// RequestStreamHandler can be used instead of RequestHandler for cases when you'd like to deserialize request body or serialize response body yourself, instead of allowing that to happen automatically
// Note that you still need to return a proper JSON for API Gateway to handle
// See Lambda Response format for examples: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
public void handleRequest(InputStream input, OutputStream output, Context context) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8)))) {

System.out.println(map.size());
log.info("Received: " + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mapper.readTree(reader)));

writer.write("{\"body\": \"" + System.currentTimeMillis() + "\"} ");
} catch (IOException e) {
log.error("Something has gone wrong: ", e);
}
}
}

2 changes: 1 addition & 1 deletion powertools-e2e-tests/handlers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
<jdk>[21,)</jdk>
</activation>
<properties>
<aspectj.version>1.9.21.M1</aspectj.version>
<aspectj.version>1.9.21</aspectj.version>
</properties>
</profile>
</profiles>
Expand Down
0